Skip to content

npm: publish via OIDC trusted publishing - #152

Merged
yourconscience merged 1 commit into
mainfrom
npm/trusted-publishing
Aug 25, 2026
Merged

npm: publish via OIDC trusted publishing#152
yourconscience merged 1 commit into
mainfrom
npm/trusted-publishing

Conversation

@yourconscience

@yourconscience yourconscience commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Migrate npm releases from token-based authentication to OIDC trusted publishing.

Enhancements:

  • Update npm release publishing to use OIDC trusted publishing with provenance enabled.

Build:

  • Use Node.js 24 for npm release publishing.

@sourcery-ai

sourcery-ai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The release workflow now uses Node.js 24 and npm provenance without supplying a long-lived NPM token, enabling OIDC-based trusted publishing through the configured npm registry.

File-Level Changes

Change Details Files
Switch npm release authentication to OIDC trusted publishing while enabling provenance.
  • Upgrade the release job to Node.js 24.
  • Remove the static NPM token environment variable.
  • Retain npm provenance generation for published packages.
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/release.yml" line_range="46" />
<code_context>
       - uses: actions/setup-node@v4
         with:
-          node-version: 20
+          node-version: 24
           registry-url: https://registry.npmjs.org

</code_context>
<issue_to_address>
**issue (bug_risk):** Setting only `node-version: 24` does not guarantee an npm version that supports trusted publishing; the initial Node 24 releases bundled npm 11.3.x, while npm OIDC trusted publishing requires npm 11.5.1 or newer, so `npm publish` fails authentication instead of publishing.

**Triggers:** When the resolved Node 24 distribution bundles npm older than 11.5.1.

**Suggested fix:** Install or invoke npm 11.5.1 or newer explicitly, or pin a Node release whose bundled npm satisfies that requirement.

```suggestion
          node-version: 24.5.0
```
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and this changes how the release workflow authenticates to npm, replacing a stored token with OIDC-based trusted publishing. If the trust configuration is wrong, publishing may fail and reverting restores the token path, but a mis-scoped identity could also allow an unintended workflow to publish a package that cannot be fully removed from npm.

Blocking findings: .github/workflows/release.yml:46


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Setting only node-version: 24 does not guarantee an npm version that supports trusted publishing; the initial Node 24 releases bundled npm 11.3.x, while npm OIDC trusted publishing requires npm 11.5.1 or newer, so npm publish fails authentication instead of publishing.

Triggers: When the resolved Node 24 distribution bundles npm older than 11.5.1.

Suggested fix: Install or invoke npm 11.5.1 or newer explicitly, or pin a Node release whose bundled npm satisfies that requirement.

Suggested change
node-version: 24
node-version: 24.5.0

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6e97fa8e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install an npm release that supports trusted publishing

In the npm-publish job, selecting Node 24 does not ensure the required npm CLI version: the current Node v24.15.0 distribution inspected here bundles npm 11.4.2, while npm's trusted-publishing prerequisites require npm CLI 11.5.1 or later. On a tag release using that distribution, this CLI cannot exchange the GitHub OIDC token and, now that NODE_AUTH_TOKEN is removed, npm publish fails authentication; explicitly install npm >=11.5.1 or pin a Node release verified to bundle it.

Useful? React with 👍 / 👎.

@yourconscience
yourconscience merged commit 2d01e7d into main Aug 25, 2026
5 checks passed
@yourconscience
yourconscience deleted the npm/trusted-publishing branch August 25, 2026 10:04
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