forked from evanp/inference-coop-copilot
48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
name: Publish to VS Marketplace
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Actions are pinned by commit SHA, not floating tags: a tag can be moved.
|
|
- name: Check out
|
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: '24'
|
|
|
|
- name: Verify tag matches package.json version
|
|
env:
|
|
TAG_REF: ${{ gitea.ref_name }}
|
|
run: |
|
|
tag="${TAG_REF#v}"
|
|
pkg="$(node -p "require('./package.json').version")"
|
|
echo "Tag version: $tag"
|
|
echo "package.json version: $pkg"
|
|
if [ "$tag" != "$pkg" ]; then
|
|
echo "::error::Tag v$tag does not match package.json version $pkg"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Install dependencies
|
|
# No lifecycle scripts: package install must not run repository code
|
|
# with the publishing token anywhere in the job.
|
|
run: npm ci --ignore-scripts --no-audit --fund=false
|
|
|
|
- name: Type-check, lint, and bundle
|
|
run: npm run package
|
|
|
|
- name: Publish to VS Marketplace
|
|
env:
|
|
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
|
# Use the locked local vsce, never `npx` (which can fetch a different
|
|
# package version from the registry at publish time).
|
|
run: ./node_modules/.bin/vsce publish -p "$VSCE_PAT" --skip-duplicate
|