96 lines
3.2 KiB
YAML
96 lines
3.2 KiB
YAML
name: "Main"
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
name: Lint
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: "14"
|
|
- run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
|
|
shell: bash
|
|
- run: npm install
|
|
- name: Cache node modules
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
- run: npm run lint
|
|
env:
|
|
DISPLAY: ":99.0"
|
|
package:
|
|
runs-on: ubuntu-latest
|
|
needs: lint
|
|
name: Package
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: "14"
|
|
- run: npm install
|
|
- name: Cache node modules
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
- run: npm install -g vsce
|
|
- run: vsce package
|
|
- run: echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV
|
|
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
path: ${{ env.VSIX_PATH }}
|
|
name: ${{ env.VSIX_NAME }}
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: package
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
name: Release
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: "14"
|
|
- run: npm install
|
|
- run: npm install -g vsce
|
|
- run: vsce package
|
|
- run: echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV
|
|
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
|
|
- uses: actions/create-release@v1
|
|
id: create_release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: ${{ github.ref }}
|
|
body: See [CHANGE LOG](https://github.com/maksim77/gitcheck/blob/main/CHANGELOG.md) for details.
|
|
draft: false
|
|
prerelease: false
|
|
- uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ${{ env.VSIX_PATH }}
|
|
asset_name: ${{ env.VSIX_NAME }}
|
|
asset_content_type: application/zip
|
|
- run: vsce publish |