Skip to content

ci: harden prerelease publish job #1191

ci: harden prerelease publish job

ci: harden prerelease publish job #1191

Workflow file for this run

name: ci

Check failure on line 1 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yaml

Invalid workflow file

(Line: 47, Col: 9): Unrecognized named-value: 'env'. Located at position 67 within expression: github.event_name == 'push' && github.ref == 'refs/heads/main' && env.VSCE_PAT != ''
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' && env.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: Publish prerelease to VS Code Marketplace
run: npx vsce publish --pre-release ${{ steps.version.outputs.value }}