Skip to content

ci(release): switch npm publish to Trusted Publishers (OIDC), drop NPM_TOKEN - #195

Merged
kalwalt merged 2 commits into
devfrom
fix/oidc-npm-publish
Sep 6, 2026
Merged

ci(release): switch npm publish to Trusted Publishers (OIDC), drop NPM_TOKEN#195
kalwalt merged 2 commits into
devfrom
fix/oidc-npm-publish

Conversation

@kalwalt

@kalwalt kalwalt commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #194. The NPM_TOKEN secret (classic npm auth token) expired and broke the last release's publish step. npm Trusted Publishers is now configured for @webarkit/jsfeat-next on npmjs.com; this switches release.yml to use it.

  • Removed NODE_AUTH_TOKEN from the "Publish to npm" step. id-token: write was already present at the workflow level (added for --provenance), so the token was the only remaining blocker — leaving it in would keep shadowing the OIDC exchange regardless of what's configured on npm's side.
  • Added an "Update npm for trusted-publishing support" step (npm install -g npm@latest) right before publish: Trusted Publishers needs npm ≥ 11.5.1, and Node 24.18.0 (pinned in .nvmrc) bundles npm 10.9.4. Only the publish step needs the newer CLI.
  • Updated MAINTAINERS.md's release runbook: replaced the NPM_TOKEN one-time-setup section with the Trusted Publisher configuration steps.

Testing

This can't be exercised by CI (no tag push happens on this PR) — verification is a real tag push or workflow_dispatch re-run against an existing tag, per #194's acceptance criteria, once this merges and a release is actually cut. Reviewed the diff for correct YAML indentation (matches the file's existing step structure) and confirmed prettier --check passes on both changed files.

Closes #194.

…M_TOKEN

The NPM_TOKEN secret (a classic npm auth token) expired and broke the last
release's publish step. npm Trusted Publishers is now configured for
@webarkit/jsfeat-next on npmjs.com; this switches the workflow to use it.

- Removed NODE_AUTH_TOKEN from the "Publish to npm" step. id-token: write
  was already present at the workflow level (added for provenance), so it
  didn't need adding -- the token was the only remaining blocker, and
  leaving it in would have kept shadowing the OIDC exchange even with
  trusted publishing configured on npm's side.
- Added an "Update npm for trusted-publishing support" step
  (npm install -g npm@latest) right before publish: Trusted Publishers
  needs npm >= 11.5.1, and Node 24.18.0 (pinned in .nvmrc) bundles npm
  10.9.4. Only the publish step needs the newer CLI, so install/build/test
  above still run on the pinned toolchain.
- Updated MAINTAINERS.md's release runbook: replaced the NPM_TOKEN
  one-time-setup section with the Trusted Publisher configuration steps
  (provider, repo, workflow filename) and a note on what to check if
  publishing starts failing again (the Trusted Publisher config itself,
  not a token to rotate).

Closes #194.
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Switch npm releases to OIDC Trusted Publishing

🐞 Bug fix ⚙️ Configuration changes 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Replaces expired npm secret authentication with OIDC-backed Trusted Publishing.
• Upgrades npm immediately before publishing to satisfy Trusted Publisher requirements.
• Documents npm-side publisher setup and authentication troubleshooting.
Diagram

sequenceDiagram
    actor Maintainer
    participant Workflow as Release Workflow
    participant CLI as npm CLI 11+
    participant OIDC as GitHub OIDC
    participant Registry as npm Registry
    Maintainer->>Workflow: Push tag or dispatch
    Workflow->>CLI: Upgrade then publish
    CLI->>OIDC: Request identity token
    OIDC-->>CLI: Return short-lived token
    CLI->>Registry: Exchange identity and publish
    Registry-->>CLI: Confirm package
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Pin a supported npm 11 version
  • ➕ Makes the release toolchain reproducible across runs
  • ➕ Avoids unexpected behavior from future npm major releases
  • ➖ Requires periodic maintenance as Trusted Publishing requirements evolve
  • ➖ May miss npm publishing fixes available in newer releases

Recommendation: The OIDC migration is preferable to restoring a long-lived npm token because it removes secret expiration and rotation risks. Installing npm only before publishing also preserves the pinned build and test toolchain; however, pinning a supported npm 11 release or major could reduce release-time drift compared with npm@latest.

Files changed (2) +22 / -12

Bug fix (1) +13 / -2
release.ymlPublish releases through npm Trusted Publishers +13/-2

Publish releases through npm Trusted Publishers

• Upgrades npm immediately before publishing so the CLI supports Trusted Publishing. Removes NODE_AUTH_TOKEN, allowing npm to exchange the workflow's GitHub OIDC identity for a short-lived publish credential while retaining provenance.

.github/workflows/release.yml

Documentation (1) +9 / -10
MAINTAINERS.mdDocument Trusted Publisher release setup +9/-10

Document Trusted Publisher release setup

• Replaces NPM_TOKEN creation and rotation instructions with npm Trusted Publisher configuration details. Documents required repository and workflow identifiers, OIDC permissions, CLI requirements, and authentication troubleshooting.

MAINTAINERS.md

@qodo-code-review

qodo-code-review Bot commented Sep 5, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Required publish permission omitted ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
The Trusted Publisher setup instructions omit the required “Allowed actions” selection, so a
publisher created or recreated after May 20, 2026 cannot be configured from the runbook as written.
The configuration must explicitly allow npm publish for this workflow’s publish command.
Code

MAINTAINERS.md[R107-110]

+   - **Provider:** GitHub Actions
+   - **Repository:** `webarkit/jsfeatNext`
+   - **Workflow filename:** `release.yml`
+   - **Environment:** leave blank unless the workflow is later scoped to a GitHub Environment
Evidence
The runbook lists Provider, Repository, Workflow filename, and Environment but no Allowed actions
setting. npm’s current documentation states that Allowed actions is required, at least one action
must be selected, and configurations created after May 20, 2026 require an explicit selection.

MAINTAINERS.md[106-111]
.github/workflows/release.yml[132-141]
🌐 npm documents “Allowed actions” as required and says publishers created after May 20, 2026 must explicitly select npm publish, npm stage publish, or both.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The npm Trusted Publisher runbook omits the required **Allowed actions** field. Add an instruction to select `npm publish`, matching the command used by the release workflow.

## Issue Context
npm requires Trusted Publisher configurations created after May 20, 2026 to explicitly allow at least one action. This workflow uses `npm publish`, not staged publishing.

## Fix Focus Areas
- MAINTAINERS.md[106-111]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 27 rules
✅ Web pages:
  +6 more
Review mode: ⚖️ Balanced: This changes release authentication and CI publishing behavior through OIDC, npm tooling, and permissions, making it security- and deployment-sensitive despite the small diff.

Grey Divider

Tip of the day
💡 Did you know, you can show, collapse, or hide each part of a finding: code, evidence, and all

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread MAINTAINERS.md
@kalwalt kalwalt self-assigned this Sep 5, 2026
@kalwalt kalwalt added bug Something isn't working enhancement New feature or request CI/CD github_actions Pull requests that update GitHub Actions code npm labels Sep 5, 2026
@kalwalt kalwalt added this to the 1.0.0 milestone Sep 5, 2026
…w npm publish

Qodo's review of PR #195 caught a real gap: since Sep 3 2026 npm defaults a
new Trusted Publisher configuration to allow npm stage publish only -- a
two-phase flow requiring a maintainer to separately approve each release
interactively (2FA, no OIDC) before it goes public. release.yml has no such
approval step and calls npm publish directly, so following the runbook as
written would leave the publish step failing on a missing permission
instead of an expired token -- the exact class of problem #194/#195 set
out to fix.

Added the "Allowed actions: npm publish" instruction, with a note that
npm stage publish's extra manual gate is worth considering later (e.g. if
this project ever has more maintainers), but isn't what the current
workflow implements.
@kalwalt
kalwalt merged commit 3a2d9c7 into dev Sep 6, 2026
5 checks passed
@kalwalt
kalwalt deleted the fix/oidc-npm-publish branch September 6, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CI/CD enhancement New feature or request github_actions Pull requests that update GitHub Actions code npm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant