Skip to content

ci: publish to npm via Trusted Publishing (OIDC)#11

Merged
baransu merged 2 commits into
mainfrom
baransu/npm-trusted-publishers
Jun 2, 2026
Merged

ci: publish to npm via Trusted Publishing (OIDC)#11
baransu merged 2 commits into
mainfrom
baransu/npm-trusted-publishers

Conversation

@baransu
Copy link
Copy Markdown
Contributor

@baransu baransu commented Jun 2, 2026

Switches npm publishing from a long-lived NPM_TOKEN secret to npm Trusted Publishing (OIDC). The publish job now requests id-token: write so npm can exchange a short-lived GitHub OIDC token for a publish credential, and yarn publish is replaced with npm publish since Yarn Classic does not support OIDC. Node is bumped to 24 with an explicit npm install -g npm@latest to meet the npm >= 11.5.1 requirement, and provenance is now attached automatically.

Replace the long-lived NPM_TOKEN secret with npm Trusted Publishing.
The publish job now requests `id-token: write` so npm can exchange a
short-lived GitHub OIDC token for a publish credential, bumps Node to
24 (with an explicit npm upgrade for the >= 11.5.1 requirement), and
swaps `yarn publish` for `npm publish` since Yarn Classic does not
support OIDC. Provenance is attached automatically.
@baransu baransu self-assigned this Jun 2, 2026
Replace Yarn Classic with npm across both workflows and the docs example:
swap `yarn install --frozen-lockfile` for `npm ci`, `yarn build`/`yarn lint`
for `npm run build`/`npm run lint`, `yarn version` for `npm version`, and
the setup-node cache to "npm". Delete both yarn.lock files in favor of
generated package-lock.json files.
with:
node-version: "18.15"
cache: "yarn"
cache: "npm"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

welcomed change.

@baransu baransu merged commit 218af52 into main Jun 2, 2026
1 check passed
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.

2 participants