feat: use npm trusted publishing instead of NPM_TOKEN#678
Merged
morgante merged 1 commit intobiomejs:mainfrom Mar 30, 2026
Merged
feat: use npm trusted publishing instead of NPM_TOKEN#678morgante merged 1 commit intobiomejs:mainfrom
morgante merged 1 commit intobiomejs:mainfrom
Conversation
Switch from NPM_TOKEN-based authentication to npm trusted publishing (OIDC) for publishing to npm. This eliminates the need for long-lived npm access tokens and improves security. Changes: - Add registry-url to actions/setup-node for OIDC token exchange - Install npm@11.6.1 which supports trusted publishing - Remove manual .npmrc token configuration - Remove NPM_TOKEN secret usage - Pass --provenance flag directly to npm publish commands - Keep id-token: write permission (already present)
morgante
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switch from
NPM_TOKEN-based authentication to npm trusted publishing (OIDC) for publishing to npm. This eliminates the need for long-lived npm access tokens and improves security.Changes
registry-url: 'https://registry.npmjs.org'toactions/setup-node— required for OIDC token exchangenpm@11.6.1which supports trusted publishing (reference: nx-plugin-for-aws CI).npmrctoken configuration (echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc)NPM_TOKENsecret usage — no longer needed with OIDC--provenanceflag directly tonpm publishcommandsid-token: writepermission (already present)How it works
Trusted publishing creates a trust relationship between npm and GitHub Actions using OIDC. When configured, npm accepts publishes from the authorized workflow using short-lived, cryptographically-signed tokens instead of long-lived access tokens. The npm CLI automatically detects the OIDC environment and uses it for authentication.
Setup steps
Before merging this PR, the platform-specific npm packages need to be created for the first time (most don't exist yet). Here's the suggested approach:
NPM_TOKENto GitHub secrets and run the existing workflow as-is — this will publish all the new packages for the first timebiomejs/gritqlrepo with.github/workflows/napi.yamlworkflow)NPM_TOKENsecret — trusted publishing handles auth from here onPackages that already exist
@getgrit/gritql(v0.0.1)@getgrit/gritql-darwin-arm64(v0.0.0)Packages that need to be created first (11)
@getgrit/gritql-win32-x64-msvc,@getgrit/gritql-darwin-x64,@getgrit/gritql-darwin-universal,@getgrit/gritql-linux-x64-gnu,@getgrit/gritql-linux-x64-musl,@getgrit/gritql-linux-arm64-gnu,@getgrit/gritql-linux-arm64-musl,@getgrit/gritql-win32-arm64-msvc,@getgrit/gritql-android-arm64,@getgrit/gritql-freebsd-x64,@getgrit/gritql-linux-riscv64-gnu