Skip to content

ci: publish to npm via trusted publishing (OIDC) - #143

Closed
sherlock-stallion wants to merge 1 commit into
mainfrom
ci/npm-trusted-publishing
Closed

sherlock-stallion wants to merge 1 commit into
mainfrom
ci/npm-trusted-publishing

Conversation

@sherlock-stallion

Copy link
Copy Markdown
Contributor

Drop NPM_TOKEN and let npm authenticate the publish through GitHub's OIDC token instead. This needs id-token: write, which replaces the blanket write-all with the scopes the release actually uses.

Trusted publishing only exists in @semantic-release/npm 13.1.0 and later; the pinned semantic-release 19.0.3 resolves 9.0.2, which always writes an auth token into .npmrc and runs npm whoami, so it cannot publish without a token. Bump to semantic-release 25.0.9 (resolves @semantic-release/npm 13.2.0) and move @semantic-release/changelog and @semantic-release/git to majors that support it.

Those packages raise the Node floor to ^22.14.0 || >=24.10.0 (changelog and git want >=24.15), and semantic-release fails hard rather than warning when the runtime is older, so the shared setup action moves from Node 20 to 24. Since yarn errors on incompatible engines, the same bump is what keeps yarn install --frozen-lockfile working for the pre-release checks too.

npm ties the trusted publisher to this workflow's file name, so ci.yml is updated in place rather than replaced by a new release workflow.

Drop NPM_TOKEN and let npm authenticate the publish through GitHub's OIDC
token instead. This needs id-token: write, which replaces the blanket
write-all with the scopes the release actually uses.

Trusted publishing only exists in @semantic-release/npm 13.1.0 and later;
the pinned semantic-release 19.0.3 resolves 9.0.2, which always writes an
auth token into .npmrc and runs npm whoami, so it cannot publish without a
token. Bump to semantic-release 25.0.9 (resolves @semantic-release/npm
13.2.0) and move @semantic-release/changelog and @semantic-release/git to
majors that support it.

Those packages raise the Node floor to ^22.14.0 || >=24.10.0 (changelog and
git want >=24.15), and semantic-release fails hard rather than warning when
the runtime is older, so the shared setup action moves from Node 20 to 24.
Since yarn errors on incompatible engines, the same bump is what keeps
yarn install --frozen-lockfile working for the pre-release checks too.

npm ties the trusted publisher to this workflow's file name, so ci.yml is
updated in place rather than replaced by a new release workflow.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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