Skip to content

Commit 0dd510b

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
1 parent 5b2b2e7 commit 0dd510b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

.github/workflows/publish.yaml

Lines changed: 8 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,19 @@ 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+
5152
- name: 'Install Packages'
5253
run: 'pnpm i --frozen-lockfile'
5354

@@ -87,5 +88,4 @@ jobs:
8788
if: github.event.inputs.skip_publish == 'false'
8889
run: "pnpm publish --recursive ${{ github.event.inputs.stable_release == 'true' && ' ' || '--tag next' }}"
8990
env:
90-
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
9191
NPM_CONFIG_PROVENANCE: 'true'

0 commit comments

Comments
 (0)