ci: ensure vsce uses computed prerelease version #1192
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 | ||
Check failure on line 1 in .github/workflows/ci.yaml
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "22" | ||
- run: yarn | ||
- run: yarn prettier --check . | ||
- run: yarn lint | ||
- run: yarn build | ||
test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "22" | ||
- run: yarn | ||
- run: yarn test:ci | ||
preview: | ||
name: preview prerelease (marketplace) | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.VSCE_PAT != '' }} | ||
runs-on: ubuntu-22.04 | ||
needs: [lint, test] | ||
concurrency: | ||
group: preview-marketplace | ||
cancel-in-progress: true | ||
permissions: | ||
contents: read | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "22" | ||
- run: yarn | ||
- name: Compute prerelease version | ||
id: version | ||
run: | | ||
BASE_VERSION=$(node -p "require('./package.json').version") | ||
SHORT_SHA=${GITHUB_SHA::7} | ||
echo "value=${BASE_VERSION}-pre.${GITHUB_RUN_NUMBER}.${SHORT_SHA}" >> $GITHUB_OUTPUT | ||
- name: Update package.json version | ||
run: npm version "${{ steps.version.outputs.value }}" --no-git-tag-version | ||
- name: Publish prerelease to VS Code Marketplace | ||
run: npx vsce publish --pre-release |