Skip to content

Prepare VS Code Check release pipeline #6

Prepare VS Code Check release pipeline

Prepare VS Code Check release pipeline #6

Workflow file for this run

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@v4
- name: Setup Node.js
uses: actions/setup-node@v4
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@v4
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@v4
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@v4
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