Skip to content

chore: Publish via npm OIDC trusted publishing - #604

Closed
MatiPl01 wants to merge 1 commit into
mainfrom
chore/oidc-trusted-publishing
Closed

chore: Publish via npm OIDC trusted publishing#604
MatiPl01 wants to merge 1 commit into
mainfrom
chore/oidc-trusted-publishing

Conversation

@MatiPl01

@MatiPl01 MatiPl01 commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Moves publishing off a long-lived NPM_TOKEN and onto npm's OIDC trusted publishing, so a release can't break again from an expired or missing token (which is what just happened). Publishing also gets provenance automatically.

Why the version bumps: token-less trusted publishing lives in @semantic-release/npm 13.1.x, and semantic-release loads its own bundled copy of that plugin - so the core has to move too. semantic-release 24.x bundles the 12.x (no OIDC) plugin; 25.x bundles 13.1.x. Yarn's yarn npm publish can't do OIDC at all, which is why the publisher swaps from semantic-release-yarn back to the first-party @semantic-release/npm.

Changes: semantic-release ^25.0.5, publisher plugin @semantic-release/npm in .releaserc, and release.yml gains id-token: write, runs on node 24, drops NPM_TOKEN, and adds a dry-run input. Rest of the pipeline is unchanged.

Before this can publish (one manual step): configure a GitHub Actions trusted publisher for react-native-sortables on npmjs.com (repo MatiPl01/react-native-sortables, workflow release.yml). Then run 🚀 Release with dry-run on to verify auth, then off to publish; delete the NPM_TOKEN secret afterwards.

Validated locally with semantic-release --dry-run: loads @semantic-release/npm 13.1.5, runs the full pipeline under sr25, computes 1.10.0; yarn install --immutable passes. The OIDC exchange itself is exercised by the dry-run workflow run.

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
react-native-sortables-docs Ignored Ignored Preview Jul 9, 2026 9:47pm

@MatiPl01 MatiPl01 self-assigned this Jul 9, 2026
@github-actions github-actions Bot added chore ci dependencies Pull requests that update a dependency file labels Jul 9, 2026
@MatiPl01
MatiPl01 force-pushed the chore/oidc-trusted-publishing branch from 4b4e193 to 78ba207 Compare July 9, 2026 21:42
Yarn's publish path cannot use npm's OIDC trusted publishing, so the
release still depended on a long-lived NPM_TOKEN. That token expired and
broke the release. Move publishing onto @semantic-release/npm with OIDC:

- Bump semantic-release to 25.x, whose bundled @semantic-release/npm is
  13.1.x, the version that added token-less trusted publishing. This is
  required: 24.x bundles 12.x (no OIDC), and semantic-release loads its
  own bundled copy, so adding @semantic-release/npm as a direct dep alone
  does not take effect.
- .releaserc: swap the publisher plugin from semantic-release-yarn to
  @semantic-release/npm.
- release.yml: add id-token: write, run on node 24 (ships npm >= 11.6,
  which OIDC needs), drop the NPM_TOKEN env, add a dry-run toggle.

A local `semantic-release --dry-run` confirms it loads @semantic-release/npm
13.1.5 and computes 1.10.0. Requires a GitHub Actions trusted publisher to
be configured for the package on npmjs.com before the next release.
@MatiPl01

Copy link
Copy Markdown
Owner Author

Superseded by #608, which does the OIDC swap on its own, with the semantic-release v25 upgrade split out into #607 (its prerequisite).

@MatiPl01 MatiPl01 closed this Jul 23, 2026
MatiPl01 added a commit that referenced this pull request Jul 23, 2026
Moves npm publishing from the long-lived `NPM_TOKEN` to GitHub OIDC
trusted publishing, so a release can't break again when the token
expires (which is what happened on the last run). Provenance comes along
for free.

`semantic-release-yarn` can't do OIDC, so publishing goes back to
`@semantic-release/npm` (13.1.x added trusted publishing). The workflow
gains `id-token: write`, drops the token env, and gets a dry-run toggle.

Stacked on #607. Before the next release, a trusted publisher needs to
be set up once on npmjs.com for this repo + `release.yml`; then run the
workflow with dry-run on to confirm auth, and delete the `NPM_TOKEN`
secret.

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

Labels

chore ci dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant