Skip to content

ci: migrate npm publishing to OIDC trusted publishing - #10

Open
upsetbit wants to merge 2 commits into
masterfrom
oidc-trusted-publishing
Open

ci: migrate npm publishing to OIDC trusted publishing#10
upsetbit wants to merge 2 commits into
masterfrom
oidc-trusted-publishing

Conversation

@upsetbit

Copy link
Copy Markdown
Contributor

What & why

Replace the long-lived NPM_TOKEN in the npm release with npm OIDC trusted publishing (GA'd 2025-07-31). The release job exchanges a short-lived GitHub Actions id-token for publish credentials — no stored secret — and provenance is issued automatically.

Changes

  • release.yml: remove the NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} env; add an npm install -g npm@latest step (trusted publishing needs npm ≥ 11.5.1). permissions: id-token: write was already present; the job already runs on ubuntu-latest.
  • scripts/publish-npm.sh: add --provenance to the npm publish calls; update the header comment (no token needed).

⚠️ Before merging / next release

Register the trusted publisher on npm for all 5 packages first, otherwise the tokenless publish fails:
@c3-oss/q + -darwin-arm64, -darwin-amd64, -linux-amd64, -linux-arm64 — repo c3-oss/q, workflow release.yml. Run the org-wide setup-trusted-publishers.sh.

Suggested validation: cut a pre-release tag (e.g. v<next>-rc1) and confirm the publish is green with a provenance badge and no NPM_TOKEN use. Keep the NPM_TOKEN secret until validated, then delete it.

🤖 Generated with Claude Code

upsetbit and others added 2 commits July 17, 2026 15:27
Drop NODE_AUTH_TOKEN/NPM_TOKEN and upgrade npm to >= 11.5.1 in-job so the
publish authenticates via npm OIDC trusted publishing (id-token: write is
already granted). Emit provenance from publish-npm.sh (GitHub-hosted).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
OIDC trusted publishing publishes with --provenance, and npm validates each
manifest's repository.url against the repo recorded in the sigstore bundle. The
four platform sub-packages only declared homepage, so the first publish would
fail with 422 Unprocessable Entity — as it did for c3-oss/prosa#320. Nothing
surfaces this under NPM_TOKEN, because no provenance statement is generated.

Adds the repository field to all four sub-packages and a pre-flight assertion
next to the existing version check, so a mismatch aborts before any package is
published rather than midway through the loop.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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