ci(release): use npm trusted publishing via OIDC#1028
Merged
pgoodjohn merged 1 commit intoJun 12, 2026
Conversation
Grant id-token write permission, upgrade npm to a version that supports trusted publishing, and drop NPM_TOKEN so semantic-release authenticates to the registry via OIDC instead of a long-lived token. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 4.3.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
The release workflow currently fails to publish to npm because it still authenticates with
NPM_TOKENinstead of using the trusted publishing (OIDC) configuration set up on npmjs.com. See the failing run: https://github.com/commitizen/cz-cli/actions/runs/27391262960/job/80976026728Three things were needed to make OIDC actually take over:
id-token: writeon the job so GitHub Actions can mint the OIDC token npm exchanges for a short-lived publish credential.contents/issues/pull-requests: writeare also added because semantic-release pushes tags, creates GitHub releases, and comments on released PRs/issues.>= 11.5.1).actions/setup-node@v4withnode-version: lts/*currently ships npm 10.x, which silently falls back to token auth.NPM_TOKENfrom the env.@semantic-release/npmuses the token whenever it is present, so OIDC was never being attempted even after trusted publishing was configured on the registry side.Test plan
masterand confirm the next release run authenticates via OIDC (look fornpm noticelines about provenance / trusted publishing instead of a token-auth step).