Skip to content

ci: publish to npm via trusted publishing - #19

Merged
vilenarios merged 2 commits into
mainfrom
ci/npm-trusted-publishing
Aug 28, 2026
Merged

ci: publish to npm via trusted publishing#19
vilenarios merged 2 commits into
mainfrom
ci/npm-trusted-publishing

Conversation

@vilenarios

Copy link
Copy Markdown
Contributor

Why

NPM_TOKEN and the now-dead DEPLOY_PAT were both set on 2026-06-11. The 1.0.2 release failed at the git push, before the publish step ever ran — so there is currently no evidence NPM_TOKEN is still valid. Long-lived registry credentials are the failure mode that just cost us a release.

What

Grants id-token: write to the release job. @semantic-release/npm@13.1.5 already supports npm trusted publishing natively: it detects GitHub Actions, calls getIDToken("npm:registry.npmjs.org"), and exchanges it for a short-lived publish token. Publishes made this way also carry a provenance attestation.

Safety

verify-auth.js short-circuits only when the OIDC exchange succeeds:

if (await oidcContextEstablished(registry, pkg, context)) return
await setNpmrcAuth(npmrc, registry, context)

NODE_AUTH_TOKEN is left in place, so if the trusted publisher is not yet registered the plugin logs a failed exchange and falls back to the token exactly as today. This PR is therefore inert until the npmjs.com side is configured, and drops the token dependency the moment it is.

Follow-up (not in this PR)

  • Register the trusted publisher for @ar.io/deploy on npmjs.com: repo ar-io/ar-io-deploy, workflow release.yml.
  • Once a release succeeds over OIDC, delete the NPM_TOKEN secret and the NODE_AUTH_TOKEN line.
  • Separately, the runner warns that actions/checkout@v4, setup-node@v4 and pnpm/action-setup@v4 are forced onto Node 24.

Grants id-token: write so @semantic-release/npm can exchange a GitHub
OIDC token for a short-lived registry token. NODE_AUTH_TOKEN remains the
fallback, so this is inert until the trusted publisher is registered on
npmjs.com.
DEPLOY_PAT existed only so @semantic-release/git could push the release
commit past the two-stage ruleset. Bypassing that ruleset for the GitHub
Actions app removes the need for any personal credential, matching
turbo-sdk, which runs the same release on the plain GITHUB_TOKEN.
@vilenarios
vilenarios merged commit 6a205d6 into main Aug 28, 2026
7 checks passed
@vilenarios
vilenarios deleted the ci/npm-trusted-publishing branch August 28, 2026 23:08
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