Skip to content

ci(release): switch to npm trusted publishing (OIDC) - #153

Merged
megheaiulian merged 1 commit into
mainfrom
chore/trusted-publishing
Jul 31, 2026
Merged

megheaiulian merged 1 commit into
mainfrom
chore/trusted-publishing

Conversation

@megheaiulian

Copy link
Copy Markdown

Summary

Replace expired NPM_TOKEN with npm trusted publishing (OIDC-based short-lived tokens from GitHub Actions). @semantic-release/npm 13.1+ auto-detects OIDC when id-token: write permission is granted — no plugin config change needed.

Changes

.github/workflows/release.yml

  • Added environment: npm to the release job
  • Added permissions block with id-token: write (OIDC key permission)
  • Added registry-url: https://registry.npmjs.org to setup-node
  • Replaced NPM_TOKEN env var with NODE_AUTH_TOKEN: "" (clears the auto-set token from setup-node that would override OIDC)

package.json

  • Added publishConfig with registry and provenance: true

Required npm-side setup (manual)

On npmjs.com → rollup-plugin-styler package → Settings → Trusted Publisher → GitHub Actions:

Field Value
Owner plumelo
Repository rollup-plugin-styler
Workflow release.yml
Environment npm

Then toggle "Require OIDC only".

After first successful OIDC publish

Delete the NPM_TOKEN secret from GitHub repo settings (Settings → Secrets and variables → Actions).

Safety

  • @semantic-release/npm falls back to NPM_TOKEN if OIDC isn't available, so this is safe to merge before the npm-side config is complete
  • No code changes — only CI config and package metadata

Replace expired NPM_TOKEN with npm trusted publishing (OIDC-based
short-lived tokens from GitHub Actions). @semantic-release/npm 13.1+
auto-detects OIDC when id-token: write permission is granted.

Changes:
- release.yml: add environment: npm, permissions block with id-token:
  write, registry-url for setup-node, clear NODE_AUTH_TOKEN to avoid
  actions/setup-node auto-setting it (which overrides OIDC)
- package.json: add publishConfig with provenance: true

Requires npm-side config on npmjs.com:
  Package → Settings → Trusted Publisher → GitHub Actions
  Owner: plumelo, Repo: rollup-plugin-styler, Workflow: release.yml,
  Environment: npm, toggle 'Require OIDC only'

Once first OIDC publish succeeds, delete the NPM_TOKEN GitHub secret.
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.97%. Comparing base (612f2e6) to head (058a07c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #153   +/-   ##
=======================================
  Coverage   98.97%   98.97%           
=======================================
  Files          36       36           
  Lines         974      974           
  Branches      317      317           
=======================================
  Hits          964      964           
  Misses         10       10           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@megheaiulian
megheaiulian merged commit 024efa8 into main Jul 31, 2026
17 checks passed
@megheaiulian
megheaiulian deleted the chore/trusted-publishing branch July 31, 2026 07:34
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant