Skip to content

ci(release): switch to npm trusted publishing (OIDC)#8

Merged
yurenju merged 1 commit into
mainfrom
claude/trusted-publishing
May 27, 2026
Merged

ci(release): switch to npm trusted publishing (OIDC)#8
yurenju merged 1 commit into
mainfrom
claude/trusted-publishing

Conversation

@yurenju
Copy link
Copy Markdown
Contributor

@yurenju yurenju commented May 27, 2026

@

Summary

Retires the long-lived NPM_TOKEN secret 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.yml

  • Add npm install -g npm@latest step before npm ci to guarantee npm ≥ 11.5.1 (the minimum that understands the OIDC token exchange). Runner-bundled npm can lag behind even on Node 24.
  • Add --provenance to npm 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.
  • Remove the env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} block from the Publish step. With OIDC the npm CLI exchanges the id-token automatically; supplying a _authToken would actually fall back to classic auth and skip OIDC.

permissions: id-token: write was 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:

After merge

  1. Re-run the failed v0.0.3 release: https://github.com/sadcoderlabs/wspc-cli/actions/runs/26509550425 — Re-run failed jobs. With the merged workflow + trusted-publisher config in place, npm publish --provenance should succeed.
  2. Revoke the old npm token: https://www.npmjs.com/settings//tokens — delete the wspc-cli automation token. With OIDC there is nothing for it to authenticate.
  3. Delete the GitHub secret: https://github.com/sadcoderlabs/wspc-cli/settings/secrets/actions — remove NPM_TOKEN.

Why this is safer

Classic / Automation token Trusted Publishing (OIDC)
Long-lived secret stored in GH Yes No
Leak surface Anywhere the secret reaches: log, env, container None — token is minted at job start, dies at job end
Rotation burden Manual every N months None
Provenance Manual --provenance flag Automatic (with --provenance for safety)
Revoking access Revoke token in npm Edit npm trusted-publisher config (no token to leak)

Sources:

@yurenju yurenju merged commit f7651b0 into main May 27, 2026
1 check passed
@yurenju yurenju deleted the claude/trusted-publishing branch May 27, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant