Skip to content

Commit d86047e

Browse files
committed
ci: Adapt publish.yaml to use npm's trusted publishing
- Add comment to clarify id-token: write permission - Remove obsolete usage of NPM auth token - Move pnpm setup before node setup to avoid pnpm overriding .npmrc changes done by node setup for trusted publishing - Update npm to latest to ensure npm version ^11.5.1
1 parent ab725ff commit d86047e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

.github/workflows/publish.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
publish:
2525
permissions:
2626
contents: 'write'
27-
id-token: 'write'
27+
id-token: 'write' # Required for npm OIDC
2828
runs-on: 'ubuntu-latest'
2929
steps:
3030
- uses: 'actions/checkout@v4'
@@ -36,17 +36,21 @@ jobs:
3636
git config user.name "jsonforms-publish[bot]"
3737
git config user.email "[email protected]"
3838
39+
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
40+
name: Install pnpm
41+
id: pnpm-install
42+
with:
43+
run_install: false
44+
3945
- name: 'Setup node'
4046
uses: 'actions/setup-node@v4'
4147
with:
4248
node-version: '22'
4349
registry-url: 'https://registry.npmjs.org'
4450

45-
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
46-
name: Install pnpm
47-
id: pnpm-install
48-
with:
49-
run_install: false
51+
# Ensure npm 11.5.1 or later for trusted publishing
52+
- name: Update npm
53+
run: npm install -g npm@latest
5054

5155
- name: 'Install Packages'
5256
run: 'pnpm i --frozen-lockfile'
@@ -87,5 +91,4 @@ jobs:
8791
if: github.event.inputs.skip_publish == 'false'
8892
run: "pnpm publish --recursive ${{ github.event.inputs.stable_release == 'true' && ' ' || '--tag next' }}"
8993
env:
90-
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
9194
NPM_CONFIG_PROVENANCE: 'true'

0 commit comments

Comments
 (0)