ci(release): switch to npm trusted publishing (OIDC)#8
Merged
Conversation
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
Retires the long-lived
NPM_TOKENsecret in favour of npm Trusted Publishing (OIDC). After this merges + the npm UI side is configured, the release workflow authenticates to npm via a short-lived OIDC token issued per workflow run — there is no long-lived secret to leak or rotate.What changes in
release.ymlnpm install -g npm@lateststep beforenpm cito guarantee npm ≥ 11.5.1 (the minimum that understands the OIDC token exchange). Runner-bundled npm can lag behind even on Node 24.--provenancetonpm publish(both dry-run and real). npm docs claim provenance is automatic under trusted publishing, but real-world reports (e.g. Phil Nash, 2026-01-28) show the flag is still required to actually emit the attestation. Defensive flag — does nothing harmful when redundant.env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}block from the Publish step. With OIDC the npm CLI exchanges the id-token automatically; supplying a_authTokenwould actually fall back to classic auth and skip OIDC.permissions: id-token: writewas already in place from a previous unrelated change — no change to permissions needed.Operator checklist before merging
The trusted-publisher configuration on the npm side must be in place before this can publish successfully. The configuration was set up at:
sadcoderlabswspc-clirelease.ymlnpm publishAfter merge
npm publish --provenanceshould succeed.wspc-cliautomation token. With OIDC there is nothing for it to authenticate.NPM_TOKEN.Why this is safer
--provenanceflag--provenancefor safety)Sources:
@