Skip to content

Commit 8cf95ec

Browse files
committed
migrate npm publish to OIDC trusted publishing
This commit updates the release workflow to use npm trusted publishing (OIDC) instead of NPM_TOKEN. it also adds required job permissions for npm OIDC auth: id-token: write and contents: read. Npm publish was kept explicit with --access public. package.json repository metadata was updated to npm-recommended object format. Issue:HD-4608
1 parent 8a1016d commit 8cf95ec

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/release.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
publish-github:
2424
runs-on: ubuntu-latest
2525
needs: check
26+
if: github.ref == 'refs/heads/main'
2627
steps:
2728
- uses: actions/checkout@v4
2829
# Setup .npmrc file to publish to GitHub Packages
@@ -37,20 +38,23 @@ jobs:
3738
publish-npm:
3839
runs-on: ubuntu-latest
3940
needs: check
41+
if: github.ref == 'refs/heads/main'
42+
permissions:
43+
id-token: write
44+
contents: read
4045
environment: npmjs
4146
steps:
4247
- uses: actions/checkout@v4
4348
# Setup .npmrc file to publish to npmjs.org
4449
- uses: actions/setup-node@v4
4550
with:
46-
node-version: '22'
51+
node-version: '24'
4752
registry-url: 'https://registry.npmjs.org'
4853
- run: npm install
49-
- run: npm publish
50-
env:
51-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54+
- run: npm publish --access public
5255
release-github:
5356
runs-on: ubuntu-latest
57+
if: github.ref == 'refs/heads/main'
5458
needs:
5559
- publish-github
5660
- publish-npm

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
"sourceMap": true,
3636
"instrument": true
3737
},
38-
"repository": "git://github.com/scality/hdclient.git ",
38+
"repository": {
39+
"type": "git",
40+
"url": "https://github.com/scality/hdclient.git"
41+
},
3942
"author": "Maxime Lubin",
4043
"dependencies": {
4144
"httpagent": "github:scality/httpagent#1.1.0",

0 commit comments

Comments
 (0)