Skip to content

Commit 735f075

Browse files
ci(release): publish GitHub Packages via built-in GITHUB_TOKEN, make it non-blocking, and make npm publish idempotent
1 parent 586bc52 commit 735f075

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ jobs:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4343

4444
- name: Publish to npm
45-
run: npm publish --access public
45+
# Idempotent: don't fail the release if this version is already published
46+
# (e.g. when re-running a partially-successful release).
47+
run: npm publish --access public || npm view "meridianalgo@${GITHUB_REF_NAME#v}" version
4648
env:
4749
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4850

@@ -57,6 +59,11 @@ jobs:
5759
node -e "const pkg = require('./package.json'); pkg.name = '@meridianalgo/meridianalgo'; pkg.publishConfig = { registry: 'https://npm.pkg.github.com' }; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));"
5860
5961
- name: Publish to GitHub Packages
62+
# Use the built-in GITHUB_TOKEN (the job already grants packages: write)
63+
# so the mirror doesn't depend on a hand-maintained PAT. Non-blocking:
64+
# a GitHub Packages hiccup must never fail a release whose npm publish
65+
# already succeeded.
66+
continue-on-error: true
6067
run: npm publish --access public
6168
env:
62-
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_TOKEN }}
69+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)