Skip to content

[CI/CD] switch npm publishing to trusted publishing (OIDC) - #28

Merged
iamalwaysuncomfortable merged 1 commit into
mainfrom
oidc-trusted-publishing
Jul 29, 2026
Merged

[CI/CD] switch npm publishing to trusted publishing (OIDC)#28
iamalwaysuncomfortable merged 1 commit into
mainfrom
oidc-trusted-publishing

Conversation

@iamalwaysuncomfortable

Copy link
Copy Markdown
Member

Motivation

Final step of the trusted-publishing migration (#26, #27): npm publishing no longer uses a registry token. The job mints a GitHub OIDC token that npm verifies against each package's trusted publisher config (org ProvableHQ, repo aleo-devnode, workflow npm-publish.yml — already configured on all six packages), exchanges it for a short-lived per-publish credential, and generates provenance attestations automatically.

Changes to npm-publish.yml:

  • permissions: id-token: write (plus contents: read for the tag guard and release-asset download).
  • registry-url removed from setup-node: it writes an .npmrc authToken line referencing $NODE_AUTH_TOKEN, and npm hard-fails on every command when a referenced env var is unset — with the token gone, keeping it would break the workflow outright.
  • Node 24 (Node 20 is EOL) and npm@12.0.1 pinned alongside the existing semver pin: trusted publishing requires npm ≥ 11.5.1 and the runner's bundled npm may lag. Exact pins for the same supply-chain reason as consolidate npm publishing for trusted publishing (OIDC) #26's semver pin.
  • NODE_AUTH_TOKEN removed from the publish step. No token is referenced anywhere in the workflows anymore.

The six packages already disallow token publishing (npmjs.com publishing-access setting), so after this merges the NPM_TOKEN repo secret is dead weight: the remaining cleanup is revoking the granular token on npmjs.com and deleting the secret.

Rollback path if the first OIDC publish fails: revert this PR, re-enable token publishing on the packages, and restore a valid NPM_TOKEN.

Test Plan

  • YAML validation passes; no functional NPM_TOKEN/NODE_AUTH_TOKEN/registry-url references remain in either workflow.
  • Real verification is the next release: the publish run should show npm exchanging the OIDC token and provenance attestations on the six package pages ("built and signed on GitHub Actions").

Related PRs

- Grant the job id-token: write (plus contents: read for the tag guard
  and release-asset download); npm publish exchanges the GitHub OIDC
  token for a short-lived per-publish credential and generates
  provenance attestations automatically.
- Drop registry-url from setup-node: it writes an .npmrc authToken line
  referencing $NODE_AUTH_TOKEN, and npm hard-fails on every command when
  a referenced env var is unset.
- Bump to Node 24 (Node 20 is EOL) and pin npm@12.0.1 alongside the
  existing semver pin — trusted publishing requires npm >= 11.5.1 and
  the runner's bundled npm may lag.
- Remove NODE_AUTH_TOKEN from the publish step; no registry token is
  referenced anywhere anymore.
@iamalwaysuncomfortable iamalwaysuncomfortable changed the title switch npm publishing to trusted publishing (OIDC) [CI/CD] switch npm publishing to trusted publishing (OIDC) Jul 29, 2026
@iamalwaysuncomfortable
iamalwaysuncomfortable merged commit 1b7f93a into main Jul 29, 2026
1 check passed
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