Skip to content

Commit cd4dbe3

Browse files
committed
minor #3142 [NPM] Configure OIDC for trusted auto-publishing (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- [NPM] Configure OIDC for trusted auto-publishing | Q | A | -------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md --> | Documentation? | no <!-- required for new features, or documentation updates --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - For new features, provide some code snippets to help understand usage. - Features and deprecations must be submitted against branch main. - Update/add documentation as required (we can help!) - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Related to https://github.blog/changelog/2025-09-29-strengthening-npm-security-important-changes-to-authentication-and-token-management/ & https://docs.npmjs.com/trusted-publishers I wasn't able to test the new workflow, but I hope it will works... 😇 I will delete our secret `NPM_PUBLISH_TOKEN` after merging Commits ------- b1e9a42 [NPM] Configure OIDC for trusted auto-publishing
2 parents ddf0222 + b1e9a42 commit cd4dbe3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/workflows/release-on-npm.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
tags:
66
- 'v2.*.*'
77

8+
permissions:
9+
id-token: write # Required for OIDC
10+
contents: read
11+
812
jobs:
913
release:
1014
runs-on: ubuntu-latest
@@ -21,15 +25,20 @@ jobs:
2125
- name: Extract version from tag
2226
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
2327

28+
# npm 11.5.1 or later is required for OIDC
29+
- run: npm install -g npm@latest
30+
2431
- run: npm i -g corepack && corepack enable
2532
- uses: actions/setup-node@v4
2633
with:
34+
registry-url: 'https://registry.npmjs.org'
2735
node-version-file: '.nvmrc'
2836
cache: 'pnpm'
2937
cache-dependency-path: |
3038
pnpm-lock.yaml
3139
package.json
3240
src/**/package.json
41+
3342
- name: Install root JS dependencies
3443
run: pnpm install --frozen-lockfile
3544

@@ -41,11 +50,6 @@ jobs:
4150
git add .
4251
git commit -m "Update versions to ${{ env.VERSION }}"
4352
44-
- name: Configure NPM authentication
45-
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
46-
env:
47-
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
48-
4953
- name: Publish on NPM
5054
run: pnpm publish --recursive --access public --no-git-checks
5155

0 commit comments

Comments
 (0)