Skip to content

ci: publish to npm via OIDC trusted publishing - #197

Merged
tarikjabiri merged 2 commits into
mainfrom
ci/npm-oidc-trusted-publishing
Sep 15, 2026
Merged

tarikjabiri merged 2 commits into
mainfrom
ci/npm-oidc-trusted-publishing

Conversation

@tarikjabiri

Copy link
Copy Markdown
Member

Summary

The v2.9.0 release failed to publish: the legacy NPM_TOKEN (from 2022) is no longer permitted to publish under npm's 2FA-bypass token restrictions. This switches the CD workflow to OIDC trusted publishing — no stored token.

  • Add job permissions: id-token: write (required for OIDC)
  • Publish with npm publish --provenance --access public (bun has no OIDC support yet); bun still handles install/build/test
  • Add actions/setup-node + npm install -g npm@latest to guarantee npm ≥ 11.5.1 (OIDC support) and provenance
  • Drop the ~/.npmrc + NPM_TOKEN step entirely

Required setup before this can publish

On npmjs.com → @tarikjabiri/dxf → Settings → Trusted Publisher, add a GitHub Actions trusted publisher:

  • Repository: dxfjs/writer
  • Workflow: .github/workflows/cd.yml

Once configured, no NPM_TOKEN secret is needed and the token can be revoked.

Re-publishing 2.9.0

After this merges and the trusted publisher is set up, re-run the failed CD job (or re-create the v2.9.0 release) to publish 2.9.0.

Replace the legacy NPM_TOKEN auth (restricted by npm's 2FA-bypass
policy) with OIDC trusted publishing. bun publish has no OIDC support,
so publish with npm while keeping bun for install/build/test. Adds
id-token: write permission and --provenance.
@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.29%. Comparing base (7ab0d04) to head (91fa22d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #197   +/-   ##
=======================================
  Coverage   81.29%   81.29%           
=======================================
  Files          78       78           
  Lines        2790     2790           
  Branches      223      223           
=======================================
  Hits         2268     2268           
  Misses        476      476           
  Partials       46       46           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Slim the pre-publish gate to bun run test, and add workflow_dispatch so
2.9.0 can be published manually without recreating the release.
@tarikjabiri
tarikjabiri merged commit 1c502c8 into main Sep 15, 2026
3 checks passed
@tarikjabiri
tarikjabiri deleted the ci/npm-oidc-trusted-publishing branch September 15, 2026 22:47

This branch was successfully deployed

1 active deployment
Preview — 91fa22d8 Deployed Sep 15, 2026 by vercel[bot]
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