Skip to content

fix(release): switch npm publish to OIDC trusted publishing#409

Merged
hertzg merged 3 commits intomasterfrom
ci/npm-oidc-trusted-publishing
Apr 30, 2026
Merged

fix(release): switch npm publish to OIDC trusted publishing#409
hertzg merged 3 commits intomasterfrom
ci/npm-oidc-trusted-publishing

Conversation

@hertzg
Copy link
Copy Markdown
Owner

@hertzg hertzg commented Apr 30, 2026

Summary

  • Switch the release workflow to npm's OIDC trusted publisher flow (docs) — no more long-lived NPM_TOKEN secret.
  • Add id-token: write plus the explicit contents/issues/pull-requests permissions semantic-release's git/github plugins need.
  • Upgrade npm to latest in the job (OIDC publish requires npm ≥ 11.5.1).
  • Bump @semantic-release/npm ^12.0.2^13.1.5 (first version that skips the NPM_TOKEN precheck under OIDC).
  • Bump semantic-release ^24.0.0^25.0.3 so the bundled @semantic-release/npm matches our direct devDep — removes a duplicate v12 copy that v24 was carrying. Brings @semantic-release/github along to v12 transitively.

Required follow-up before merging

Configure a Trusted Publisher for net-keepalive on npmjs.com:

  • Publisher: GitHub Actions
  • Owner / repo: hertzg/node-net-keepalive
  • Workflow: release.yaml
  • Environment: (blank)

Until that's set up registry-side, the next release will fail at npm publish. Once it works, the NPM_TOKEN repo secret can be deleted.

Notes

  • semantic-release@25 and @semantic-release/npm@13 both raise engines to Node ^22.14.0 || >=24.10.0. The release job uses node-version: '*' so it's fine, but anyone running npm install locally on older Node will hit engine warnings.
  • Lockfile diff is large because v13 pulls in @actions/core (+ transitives) for the OIDC token exchange, and the v24→v25 + v12→v13 churn re-resolved a lot of transitives.

Plugin tree after the bumps

├── @semantic-release/changelog@6.0.3
├── @semantic-release/exec@6.0.3
├── @semantic-release/git@10.0.1
├── @semantic-release/npm@13.1.5
└─┬ semantic-release@25.0.3
  ├── @semantic-release/commit-analyzer@13.0.1
  ├── @semantic-release/github@12.0.6
  ├── @semantic-release/npm@13.1.5 (deduped)
  └── @semantic-release/release-notes-generator@14.1.0

Test plan

  • Configure Trusted Publisher on npmjs.com
  • Merge and observe the next release run publishes via OIDC (no NPM_TOKEN used)
  • Delete the NPM_TOKEN repo secret once a successful OIDC release lands

hertzg added 3 commits April 30, 2026 14:13
Switch the release workflow to npm's OIDC trusted publisher flow so
publish credentials are minted per-run instead of a long-lived
NPM_TOKEN secret. Adds the id-token: write permission, makes the
contents/issues/pull-requests permissions explicit for the
semantic-release git and github plugins, and upgrades npm to a
version that supports OIDC publishing.

Requires a Trusted Publisher entry for this workflow to be
configured on npmjs.com before the next release runs.

Refs: https://docs.npmjs.com/trusted-publishers
v13 added support for npm's OIDC trusted publisher flow — earlier
versions still required NPM_TOKEN to be set even when the npm CLI
itself would have used OIDC. Pairs with the previous commit that
switched the release workflow over to OIDC.

Note: v13 raises the engines requirement to Node ^22.14.0 || >=24.10.0,
which is fine for the release job (uses Node *) but stricter than
other tooling in the repo.
semantic-release v25 bundles @semantic-release/npm ^13.1.1, which
matches our direct devDep and removes the duplicate v12 nested copy
that v24 was carrying. No behavior change beyond cleaning up the
plugin tree so the OIDC-capable npm plugin is the only one resolved.

Engines for v25 are Node ^22.14.0 || >=24.10.0 (same as
@semantic-release/npm v13).
@hertzg hertzg changed the title ci(release): switch npm publish to OIDC trusted publishing fix(release): switch npm publish to OIDC trusted publishing Apr 30, 2026
@hertzg hertzg merged commit b1e5eb9 into master Apr 30, 2026
29 checks passed
@hertzg hertzg deleted the ci/npm-oidc-trusted-publishing branch April 30, 2026 12:21
github-actions Bot pushed a commit that referenced this pull request Apr 30, 2026
## [4.0.25](v4.0.24...v4.0.25) (2026-04-30)

### Bug Fixes

* **deps:** update dependency ffi-rs to v1.3.2 ([#408](#408)) ([af1e557](af1e557))
* **release:** switch npm publish to OIDC trusted publishing ([#409](#409)) ([b1e5eb9](b1e5eb9))
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 4.0.25 🎉

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