ci: migrate npm release to OIDC trusted publishing with provenance#140
Merged
Conversation
- Add `id-token: write` permission so the workflow can mint an OIDC token - Set `registry-url` on setup-node and upgrade npm to the latest (>= 11.5.1), which is required for trusted publishing - Publish with `--provenance` and drop the long-lived `NPM_TOKEN` secret; authentication is now handled via OIDC trusted publishing - Add `repository` (plus `homepage`/`bugs`) to package.json — a public `repository` field matching the source repo is required to generate provenance attestations https://claude.ai/code/session_016qHimevBQJsTHzBxV7B2od
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #140 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 8 8
Lines 492 492
Branches 105 105
=========================================
Hits 492 492 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jaredwray
commented
Jun 12, 2026
| # Trusted publishing (OIDC) requires npm CLI >= 11.5.1, which is newer than | ||
| # the version bundled with Node.js 22. | ||
| - name: Update npm | ||
| run: npm install -g npm@latest |
Contributor
Author
There was a problem hiding this comment.
use pnpm instead. add in pnpm/setup action
| - name: Publish | ||
| # No NPM_TOKEN: authentication is handled via OIDC trusted publishing. | ||
| # Provenance attestations are generated from the OIDC identity. | ||
| run: npm publish --provenance --ignore-scripts |
This was referenced Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the
releaseworkflow from a long-livedNPM_TOKENto npm trusted publishing (OIDC) and enables provenance attestations on every publish.With trusted publishing, GitHub Actions mints a short-lived OIDC token that npm exchanges for ephemeral publish credentials — no secret to rotate or leak. Provenance attestations cryptographically link each published version back to the exact commit and workflow run that built it (the green "provenance" badge on npmjs.com).
Changes
.github/workflows/release.yamlid-token: writepermission (keepscontents: read) so the job can mint an OIDC token.registry-url: 'https://registry.npmjs.org'onsetup-node(per npm's trusted-publishing guidance).Update npmstep (npm install -g npm@latest) — trusted publishing requires npm CLI ≥ 11.5.1, newer than the version bundled with Node.js 22.npm publish --provenance --ignore-scriptsand remove theNPM_TOKENsecret and thenpm config set //registry.npmjs.org/:_authTokenstep.package.jsonrepositoryfield (plushomepageandbugs). Arepositoryfield that matches the source repo case-sensitively (Hyphen/nodejs-sdk) is required for npm to generate provenance attestations.The workflow change alone is not sufficient — a trusted publisher must be configured on npm, otherwise the publish will fail with an auth error. On https://www.npmjs.com/package/@hyphen/sdk → Settings → Trusted Publisher, add a GitHub Actions publisher with:
Hyphennodejs-sdkrelease.yamlThe
NPM_TOKENrepository secret can be deleted once this is in place.Verification
pnpm build— succeedspnpm test— lint clean, 233 tests pass, 100% coverage (statements/branches/functions/lines)References
https://claude.ai/code/session_016qHimevBQJsTHzBxV7B2od
Generated by Claude Code