Skip to content

Commit 41edabe

Browse files
committed
chore: update NPM publishing
fixes #464 Signed-off-by: Ry Jones <ry@linux.com>
1 parent 491b56f commit 41edabe

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/release.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ on:
99
- "v[0-9]+.[0-9]+.[0-9]+"
1010
- "v[0-9]+.[0-9]+.[0-9]+-*"
1111

12+
# ---- Global permissions for Trusted Publishing & attestations ----
13+
# id-token:write is required for OIDC (npm trusted publishing, keyless attestations)
14+
# packages:write for GHCR; attestations:write for GitHub artifact attestations (optional but recommended)
15+
permissions:
16+
contents: read
17+
1218
env:
1319
IMAGE_NAME: ${{ github.repository_owner }}/fabric-nodeenv
1420

@@ -19,22 +25,29 @@ jobs:
1925
publishnpm:
2026
runs-on: ubuntu-24.04
2127
needs: test
28+
permissions:
29+
contents: read
30+
id-token: write
2231
steps:
2332
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
2433
with:
2534
node-version: "18.x"
2635
registry-url: "https://registry.npmjs.org"
36+
# Ensure npm 11.5.1 or later for trusted publishing support
37+
- name: Update npm
38+
run: npm install -g npm@latest
2739
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
2840
with:
2941
name: node-tgzs
3042
path: build/
31-
- run: |
43+
- name: Publish packages with provenance (OIDC)
44+
# No NODE_AUTH_TOKEN needed when Trusted Publishing is enabled.
45+
# --provenance tells npm to attach SLSA provenance to the package. [oai_citation:1‡The GitHub Blog](https://github.blog/security/supply-chain-security/introducing-npm-package-provenance/?utm_source=chatgpt.com)
46+
run: |
3247
set -xev
3348
ls -lart build/
3449
cd build
3550
find . -type f -name 'fabric-*.tgz' -exec npm publish {} \;
36-
env:
37-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3851
3952
docker-build-push:
4053
name: Push Docker image

0 commit comments

Comments
 (0)