Skip to content

Commit 5b93928

Browse files
authored
Attest npm package provenance (#4724)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 2d381ad commit 5b93928

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

.github/workflows/release-make.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ jobs:
279279
needs: release
280280
if: inputs.npm
281281
uses: matrix-org/matrix-js-sdk/.github/workflows/release-npm.yml@develop
282+
permissions:
283+
contents: read
284+
id-token: write
282285
secrets:
283286
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
284287

.github/workflows/release-npm.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ on:
88
id:
99
description: "The npm package@version string we published"
1010
value: ${{ jobs.npm.outputs.id }}
11-
permissions: {} # No permissions required
11+
permissions: {}
1212
jobs:
1313
npm:
1414
name: Publish to npm
1515
runs-on: ubuntu-24.04
16+
permissions:
17+
contents: read
18+
id-token: write
1619
outputs:
1720
id: ${{ steps.npm-publish.outputs.id }}
1821
steps:
@@ -32,21 +35,15 @@ jobs:
3235
run: "yarn install --frozen-lockfile"
3336

3437
- name: 🚀 Publish to npm
35-
id: npm-publish
36-
uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1
37-
with:
38-
token: ${{ secrets.NPM_TOKEN }}
39-
access: public
40-
tag: next
41-
ignore-scripts: false
42-
43-
- name: Check npm package was published
44-
if: steps.npm-publish.outputs.id == ''
45-
run: exit 1
38+
run: npm publish --provenance --access public --tag next
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4641

4742
- name: 🎖️ Add `latest` dist-tag to final releases
4843
if: steps.npm-publish.outputs.id && !contains(steps.npm-publish.outputs.id, '-rc.')
49-
run: npm dist-tag add "$release" latest
44+
run: |
45+
release=$(jq -r '"\(.name)@\(.version)"' package.json)
46+
npm dist-tag add "$release" latest
5047
env:
5148
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5249
release: ${{ steps.npm-publish.outputs.id }}

0 commit comments

Comments
 (0)