Skip to content

chore(NODE-7566): migrate release workflow to npm Trusted Publishing#111

Open
tadjik1 wants to merge 1 commit into
mainfrom
chore/NODE-7566-npm-trusted-publishers
Open

chore(NODE-7566): migrate release workflow to npm Trusted Publishing#111
tadjik1 wants to merge 1 commit into
mainfrom
chore/NODE-7566-npm-trusted-publishers

Conversation

@tadjik1
Copy link
Copy Markdown
Contributor

@tadjik1 tadjik1 commented May 18, 2026

Description

Summary of Changes

Migrate @mongodb-js/zstd off NPM_TOKEN and onto npm Trusted Publishing (OIDC) per NODE-7566.

  • Add id-token: write to the publish job (job-level, least-privilege). The ssdlc job already has its own id-token: write for AWS OIDC.
  • Remove NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}; npm publish --provenance obtains the OIDC token automatically.
  • Top-level permissions retain only contents: write and pull-requests: write.
Notes for Reviewers

Before merging: An npm Trusted Publishing entry must be configured on npmjs.com for the @mongodb-js/zstd package, pointing at release.yml in this repo. Once verified, NPM_TOKEN can be removed from the repo secrets and the package switched to "Require two-factor authentication and disallow tokens."

Double check the following

  • Lint is passing
  • Self-review completed
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

Switch the publish job from NPM_TOKEN to OIDC. Since @mongodb-js/zstd has
a single release workflow, release.yml is registered directly as the trusted
publisher on npmjs.com — no separate npm-publish.yml needed.

- Add id-token: write to the publish job (job-level, least-privilege).
- Remove NODE_AUTH_TOKEN / NPM_TOKEN; npm publish --provenance uses OIDC.
- Top-level permissions retain only contents: write and pull-requests: write.
@tadjik1 tadjik1 marked this pull request as ready for review May 18, 2026 11:41
@tadjik1 tadjik1 requested a review from a team as a code owner May 18, 2026 11:41
Copilot AI review requested due to automatic review settings May 18, 2026 11:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates the npm release flow from a long-lived NPM_TOKEN to npm Trusted Publishing (OIDC), narrowing GitHub token permissions to least-privilege at the job level.

Changes:

  • Drop id-token: write from top-level permissions; keep only contents: write and pull-requests: write.
  • Grant id-token: write (and contents: read) only on the publish job.
  • Remove NODE_AUTH_TOKEN/NPM_TOKEN from the npm publish --provenance step so OIDC is used instead.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PavelSafronov PavelSafronov self-assigned this May 18, 2026
Copy link
Copy Markdown

@PavelSafronov PavelSafronov left a comment

Choose a reason for hiding this comment

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

Changes look good. Let's confirm the npm package info has been updated, then we can merge this.

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.

3 participants