Skip to content

Publish to npm via OIDC trusted publishing - #2481

Merged
spaceninja merged 1 commit into
mainfrom
npm-trusted-publishing
Sep 8, 2026
Merged

Publish to npm via OIDC trusted publishing#2481
spaceninja merged 1 commit into
mainfrom
npm-trusted-publishing

Conversation

@spaceninja

Copy link
Copy Markdown
Member

Overview

The NPM_TOKEN secret is a 90-day npm granular token created 2026-08-25 that expires around 2026-11-23 — #2452 exists to renew it. npm capped granular write tokens at 90 days after revoking classic tokens entirely, so that renewal is now a permanent recurring chore. This switches to OIDC trusted publishing, which removes the stored credential and ends the cycle.

The change is small because changeset publish shells out to npm publish, which detects OIDC on its own: we add id-token: write and drop NODE_AUTH_TOKEN. registry-url was already set (required — OIDC silently fails without it), access: public is already in the changeset config, and repository matches the GitHub repo as provenance requires. The same migration was just completed on cloudfour/lighthouse-parade, which published successfully with provenance.

This includes a patch changeset, deliberately. Trusted publishing can only be verified by an actual publish, and this package releases roughly quarterly — waiting for a natural release risks reaching the token's November expiry still unverified. Releasing now exercises the new path while the existing token remains valid as a fallback. There is a live npm CLI bug (npm/cli#8976) where scoped packages 404 under OIDC, but the reported cases are workspace monorepos publishing many packages; this repo publishes a single package with no workspaces. Verifying now rather than in November is the point.

Note this references #2452 without a closing keyword, so merging won't auto-close it. The renewal reminder should stay open until a publish has actually succeeded without a token — if OIDC turns out not to work here, that reminder is the safety net.

Screenshots

Testing

Publishing can only be exercised from main, so most of this is post-merge verification.

  • Confirm npmjs.com → @cloudfour/patterns → Settings lists a trusted publisher for repository cloudfour/cloudfour.com-patterns and workflow changesets.yml (note: not release.yml — this repo's workflow has a different filename)
  • After merging, a Publish Next Version PR should open automatically, bumping to 17.2.1. Merging that PR is what triggers the actual publish
  • Watch the Release workflow run on main after that second merge — it should finish green
  • Run npm view @cloudfour/patterns version — it should report 17.2.1
  • On the npm package page, 17.2.1 should show a green Provenance badge linking back to the Actions run
  • Confirm nothing in the published package changed apart from the version — this release is infrastructure only

If the publish fails with E404, the token fallback is still available: revert this PR and the existing NPM_TOKEN will publish as before.


The NPM_TOKEN secret is a 90-day granular token expiring ~2026-11-23, tracked
by #2452. Trusted publishing removes the stored credential entirely, ending the
renewal cycle and adding provenance attestations.

Includes a patch changeset so the new publish path is exercised while the
existing token is still valid as a fallback.
@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1d367b1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudfour/patterns Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deploy Preview for cloudfour-patterns ready!

Name Link
🔨 Latest commit 1d367b1
🔍 Latest deploy log https://app.netlify.com/projects/cloudfour-patterns/deploys/6aa0753320e32400085d9353
😎 Deploy Preview https://deploy-preview-2481--cloudfour-patterns.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@spaceninja
spaceninja merged commit cad3e22 into main Sep 8, 2026
8 checks passed
@spaceninja
spaceninja deleted the npm-trusted-publishing branch September 8, 2026 21:02
@github-actions github-actions Bot mentioned this pull request Sep 8, 2026
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