Skip to content

Commit 6129b24

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 - Add npm scope and move up pnpm setup in publish workflow - Authentication via OIDC for NPM's trusted publishing may need to explicitly define scope if it doesn't match the repository owner. This is the case here because the repository owner is eclipsesource. - Move pnpm setup before node setup to avoid pnpm overriding .npmrc changes done by node setup for trusted publishing - Add always-auth option to node setup to force auth after pnpm setup
1 parent ab725ff commit 6129b24

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

.github/workflows/publish.yaml

Lines changed: 9 additions & 8 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,18 +36,20 @@ jobs:
3636
git config user.name "jsonforms-publish[bot]"
3737
git config user.email "[email protected]"
3838
39-
- name: 'Setup node'
40-
uses: 'actions/setup-node@v4'
41-
with:
42-
node-version: '22'
43-
registry-url: 'https://registry.npmjs.org'
44-
4539
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
4640
name: Install pnpm
4741
id: pnpm-install
4842
with:
4943
run_install: false
5044

45+
- name: 'Setup node'
46+
uses: 'actions/setup-node@v4'
47+
with:
48+
node-version: '22'
49+
registry-url: 'https://registry.npmjs.org'
50+
scope: '@jsonforms' # ensure OIDC token is tied to the scope
51+
always-auth: true
52+
5153
- name: 'Install Packages'
5254
run: 'pnpm i --frozen-lockfile'
5355

@@ -87,5 +89,4 @@ jobs:
8789
if: github.event.inputs.skip_publish == 'false'
8890
run: "pnpm publish --recursive ${{ github.event.inputs.stable_release == 'true' && ' ' || '--tag next' }}"
8991
env:
90-
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
9192
NPM_CONFIG_PROVENANCE: 'true'

0 commit comments

Comments
 (0)