fix(ci): add npm publish to prod-release and prevent mid-deploy cancellation (#1208)
Two issues in the pipeline: 1. cancel-in-progress: true could cancel a running deployment when a new push arrives. Deployments should never be interrupted mid-flight. Changed back to false. 2. The prod-release job bumps the version, commits, and tags — but never publishes the release version to npm. The dev-publish step publishes @dev, test-verify promotes to @next, but @latest was never updated. Users running 'npm install -g gsd-pi' would get stale versions. Added 'Build release' and 'Publish release to npm @latest' steps after the git tag push, with idempotent guard for already-published versions.
This commit is contained in:
parent
a0a341e3d3
commit
e45bff419d
1 changed files with 18 additions and 1 deletions
19
.github/workflows/pipeline.yml
vendored
19
.github/workflows/pipeline.yml
vendored
|
|
@ -8,7 +8,7 @@ on:
|
|||
|
||||
concurrency:
|
||||
group: pipeline-${{ github.sha }}
|
||||
cancel-in-progress: true
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
|
@ -168,6 +168,23 @@ jobs:
|
|||
git push origin main
|
||||
git push origin "v${{ steps.release.outputs.version }}"
|
||||
|
||||
- name: Build release
|
||||
run: npm run build
|
||||
|
||||
- name: Publish release to npm @latest
|
||||
run: |
|
||||
OUTPUT=$(npm publish 2>&1) && echo "$OUTPUT" || {
|
||||
if echo "$OUTPUT" | grep -q "cannot publish over the previously published"; then
|
||||
echo "Version already published — promoting to latest"
|
||||
npm dist-tag add gsd-pi@${{ steps.release.outputs.version }} latest
|
||||
else
|
||||
echo "$OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Create GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue