Skip to content

ci: publish to npm via Trusted Publishing (OIDC), drop NPM_TOKEN#127

Merged
PAMulligan merged 1 commit into
mainfrom
ci/npm-trusted-publishing
Jun 16, 2026
Merged

ci: publish to npm via Trusted Publishing (OIDC), drop NPM_TOKEN#127
PAMulligan merged 1 commit into
mainfrom
ci/npm-trusted-publishing

Conversation

@PAMulligan

Copy link
Copy Markdown
Contributor

Summary

npm publishing has been failing since 1.6.0 — release-please.yml published with a long-lived NPM_TOKEN that can no longer create/publish these packages (claudius-chat-widget is stuck at 1.6.0; create-claudius has never published). This switches the automatic release publish to npm Trusted Publishing (OIDC) and removes the long-lived token.

Changes

  • release-please.yml: drop NODE_AUTH_TOKEN from both publish steps; add npm install -g npm@latest (Trusted Publishing needs npm ≥ 11.5.1); bump publish Node to 22. Keeps id-token: write, registry-url, and --provenance (provenance is automatic with OIDC).
  • publish-npm.yml: correct the comment — OIDC can't do a brand-new package's first publish (npm requires the package to exist before a trusted publisher can be configured), and npm allows only one trusted publisher per package (configured for release-please.yml). Node 22 for consistency.

⚠️ Required before this is merged / before the next release

  1. Both packages must already exist at the current version on npm. Because create-claudius doesn't exist yet and OIDC can't do a first publish, do one token-based publish of claudius-chat-widget@1.8.0 and create-claudius@1.8.0 (locally, with a temporary granular All packages, read+write, bypass-2FA token).
  2. Configure a trusted publisher for each package at npmjs.com → package Settings → Trusted Publisher → GitHub Actions: organization PMDevSolutions, repository Claudius, workflow filename release-please.yml, environment blank, allowed action npm publish.
  3. After merge, the NPM_TOKEN repo secret is no longer referenced and can be removed: gh secret delete NPM_TOKEN --repo PMDevSolutions/Claudius. Delete the temporary npm token as well.

Why a token is still needed once

Per npm's docs, a package must exist before a trusted publisher can be configured, so the first publish of a new package must use a token — there's no OIDC path for it. After create-claudius exists, all future releases of both packages publish via OIDC with no stored secret.

Refs: npm Trusted Publishing docs, GA announcement.

🤖 Generated with Claude Code

release-please.yml published with a long-lived NODE_AUTH_TOKEN/NPM_TOKEN that
kept failing (claudius-chat-widget stuck at 1.6.0; create-claudius never
published). Switch the automatic release publish to npm Trusted Publishing
(OIDC): remove NODE_AUTH_TOKEN, upgrade to npm >= 11.5.1, bump publish Node to
22, and rely on the existing id-token: write permission. Each package needs a
trusted publisher (repo + release-please.yml) configured at npmjs.com.

Also correct publish-npm.yml's comment: OIDC cannot do a new package's first
publish (npm requires the package to exist before a trusted publisher can be
configured), and only one trusted publisher is allowed per package.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploying chat-widget with  Cloudflare Pages  Cloudflare Pages

Latest commit: 95e350d
Status: ✅  Deploy successful!
Preview URL: https://5315cffa.chat-widget-ejc.pages.dev
Branch Preview URL: https://ci-npm-trusted-publishing.chat-widget-ejc.pages.dev

View logs

@PAMulligan PAMulligan self-assigned this Jun 16, 2026
@PAMulligan PAMulligan added bug Something isn't working backend Cloudflare Workers API and AI integration labels Jun 16, 2026
@PAMulligan
PAMulligan merged commit 2531899 into main Jun 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Cloudflare Workers API and AI integration bug Something isn't working

Projects

Development

Successfully merging this pull request may close these issues.

1 participant