Skip to content

Commit dc8a4a5

Browse files
fix(release): add NPM_TOKEN fallback for npm publish (#240)
Addresses Copilot review comment on #239: `npm publish` had no explicit auth fallback. Past releases worked via npm Trusted Publishing (OIDC), confirmed by provenance attestations on published tarballs (e.g. termbeam@1.24.6 has `predicateType: https://slsa.dev/provenance/v1`). Adds `NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}` as a fallback so releases stay reliable if Trusted Publishing is disabled or run from a fork. Documents the dual auth model with a header comment. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5726435 commit dc8a4a5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,20 @@ jobs:
118118
fi
119119
git push origin main --follow-tags
120120
121+
# npm auth: primary path is npm Trusted Publishing via OIDC (requires
122+
# `id-token: write` above + a Trusted Publisher configured on npmjs.com
123+
# for this repo + workflow path). NODE_AUTH_TOKEN is a fallback for forks
124+
# or environments where Trusted Publishing is not configured.
121125
- name: Publish to npm
122126
if: inputs.dry-run == false
127+
env:
128+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
123129
run: npm publish --access public --provenance
124130

125131
- name: Publish to npm (dry run)
126132
if: inputs.dry-run == true
133+
env:
134+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
127135
run: npm publish --access public --provenance --dry-run
128136

129137
- name: Create GitHub Release

0 commit comments

Comments
 (0)