Update CI actions runtime #7
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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - v* | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Type-check, build, and package | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type-check and build | |
| run: npm run ci | |
| - name: Read package version | |
| id: package | |
| shell: bash | |
| run: echo "version=$(node -p 'require(\"./package.json\").version')" >> "$GITHUB_OUTPUT" | |
| - name: Create artifact directory | |
| run: mkdir -p artifacts | |
| - name: Package VSIX | |
| run: npm run package -- --out artifacts/vs-code-check-${{ steps.package.outputs.version }}.vsix | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: vs-code-check-vsix | |
| path: artifacts/*.vsix | |
| if-no-files-found: error | |
| release: | |
| name: Publish GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Validate release tag | |
| shell: bash | |
| run: | | |
| package_version="$(node -p 'require("./package.json").version')" | |
| test "v${package_version}" = "${GITHUB_REF_NAME}" | |
| - name: Prepare release notes | |
| id: notes | |
| shell: bash | |
| run: | | |
| notes_path=".github/release-notes/${GITHUB_REF_NAME}.md" | |
| if [ ! -f "${notes_path}" ]; then | |
| printf "# VS Code Check %s\n\nAutomated release for commit %s.\n" "${GITHUB_REF_NAME}" "${GITHUB_SHA}" > release-notes.md | |
| notes_path="release-notes.md" | |
| fi | |
| echo "path=${notes_path}" >> "$GITHUB_OUTPUT" | |
| - name: Download VSIX artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: vs-code-check-vsix | |
| path: artifacts | |
| - name: Publish GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: VS Code Check ${{ github.ref_name }} | |
| body_path: ${{ steps.notes.outputs.path }} | |
| files: artifacts/*.vsix |