Skip to content

Commit 431ffb1

Browse files
- Added permissions at the job level for both publish jobs — id-token: write is required for OIDC at the job level, not just the workflow level.
Replaced JS-DevTools/npm-publish with direct npm publish commands — setup-node with registry-url configures npm to use OIDC, and direct npm publish will use that configuration.
1 parent 89316f2 commit 431ffb1

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ jobs:
6767
npm-publish-build:
6868
needs: build
6969
runs-on: ubuntu-latest
70+
permissions:
71+
id-token: write # Required for OIDC
72+
contents: read
7073
steps:
7174
- uses: actions/download-artifact@v7
7275
with:
@@ -80,15 +83,17 @@ jobs:
8083
run: 'sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
8184
- name: Disable pre- and post-publish actions
8285
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
83-
- uses: JS-DevTools/npm-publish@v4.1.4
86+
- name: Publish to npm
8487
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
85-
with:
86-
tag: ${{ env.GITHUB_REF_SLUG }}
88+
run: npm publish --tag ${{ env.GITHUB_REF_SLUG }}
8789

8890
npm-publish-latest:
8991
needs: [build, npm-publish-build]
9092
runs-on: ubuntu-latest
9193
if: github.ref == 'refs/heads/main'
94+
permissions:
95+
id-token: write # Required for OIDC
96+
contents: read
9297
steps:
9398
- uses: actions/download-artifact@v7
9499
with:
@@ -99,7 +104,6 @@ jobs:
99104
registry-url: 'https://registry.npmjs.org'
100105
- name: Disable pre- and post-publish actions
101106
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
102-
- uses: JS-DevTools/npm-publish@v4.1.4
107+
- name: Publish to npm
103108
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
104-
with:
105-
tag: latest
109+
run: npm publish --tag latest

0 commit comments

Comments
 (0)