Skip to content

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

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

ci: migrate npm publishing to OIDC trusted publishing#39
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 GitHub Actions job exchanges a short-lived id-token for publish credentials — no stored secret — and provenance is issued automatically.

Changes (release-npm.yml)

  • Remove NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} from the publish step.
  • Add an npm install -g npm@latest step (trusted publishing needs npm ≥ 11.5.1; Node's bundled npm may be older).
  • Move the build matrix off Blacksmith to GitHub-hosted runners (ubuntu-latest/macos-latest/windows-latest). OIDC trusted publishing and provenance are only available on GitHub-hosted runners; standardizing the whole release there (Blacksmith stays for CI). --use-napi-cross is unchanged.
  • permissions: id-token: write was already present. --provenance/--ignore-scripts kept as-is.

⚠️ Before merging / next release

The trusted publisher must be registered on npm for all 7 packages first, otherwise the tokenless publish fails:
@c3-oss/codexcw + -darwin-arm64, -darwin-x64, -linux-arm64-gnu, -linux-x64-gnu, -linux-x64-musl, -win32-x64-msvc — repo c3-oss/codexcw, workflow release-npm.yml. Run the org-wide setup-trusted-publishers.sh (uses npm trust github).

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

🤖 Generated with Claude Code

upsetbit and others added 2 commits July 17, 2026 15:19
Drop the long-lived NPM_TOKEN: remove NODE_AUTH_TOKEN from the publish
step and rely on npm OIDC trusted publishing (npm upgraded to >= 11.5.1
in-job). Move the build matrix and publish job to GitHub-hosted runners,
required for both the OIDC token exchange and provenance.

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