Skip to content

ci(release): use npm trusted publishing via OIDC#1028

Merged
pgoodjohn merged 1 commit into
commitizen:masterfrom
pgoodjohn:fix/release-trusted-publishing
Jun 12, 2026
Merged

ci(release): use npm trusted publishing via OIDC#1028
pgoodjohn merged 1 commit into
commitizen:masterfrom
pgoodjohn:fix/release-trusted-publishing

Conversation

@pgoodjohn

@pgoodjohn pgoodjohn commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

The release workflow currently fails to publish to npm because it still authenticates with NPM_TOKEN instead 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/80976026728

Three things were needed to make OIDC actually take over:

  • Grant id-token: write on the job so GitHub Actions can mint the OIDC token npm exchanges for a short-lived publish credential. contents/issues/pull-requests: write are also added because semantic-release pushes tags, creates GitHub releases, and comments on released PRs/issues.
  • Upgrade npm to a version that supports trusted publishing (>= 11.5.1). actions/setup-node@v4 with node-version: lts/* currently ships npm 10.x, which silently falls back to token auth.
  • Drop NPM_TOKEN from the env. @semantic-release/npm uses the token whenever it is present, so OIDC was never being attempted even after trusted publishing was configured on the registry side.

Test plan

  • Merge to master and confirm the next release run authenticates via OIDC (look for npm notice lines about provenance / trusted publishing instead of a token-auth step).
  • Confirm the published version on npm shows the provenance badge.

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>
@pgoodjohn pgoodjohn merged commit 096ed52 into commitizen:master Jun 12, 2026
10 checks passed
@pgoodjohn pgoodjohn deleted the fix/release-trusted-publishing branch June 12, 2026 09:11
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant