Add Github action to publish new releases to VS Code automatically (#… #99
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - v* | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| - run: npm ci | |
| - run: xvfb-run -a npm test | |
| if: runner.os == 'Linux' | |
| - run: npm test | |
| if: runner.os != 'Linux' | |
| - run: npm run package | |
| - uses: svenstaro/[email protected] | |
| if: | | |
| matrix.os == 'ubuntu-latest' && | |
| startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: "*.vsix" | |
| file_glob: true | |
| tag: ${{ github.ref }} | |
| - name: Publish | |
| if: success() && startsWith( github.ref, 'refs/tags/releases/') && matrix.os == 'ubuntu-latest' | |
| run: npm run publish | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} |