Skip to content

Commit

Permalink
Setup npm provenance statements (#5406)
Browse files Browse the repository at this point in the history
* give publish job permissions for npm provenance

* add `—provenance` flag to `npm publish`

* remove unneeded `contents` permission
  • Loading branch information
tjenkinson authored Apr 20, 2023
1 parent ebd7993 commit a9afcd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ jobs:
needs: [config, test_unit]
if: needs.config.outputs.tag || needs.config.outputs.isMainBranch == 'true'
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3

Expand Down
4 changes: 2 additions & 2 deletions scripts/publish-npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [[ $(node ./scripts/check-already-published.js) = "not published" ]]; then
# see https://docs.npmjs.com/private-modules/ci-server-config
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
if [[ -z "$TAG" ]]; then
npm publish --tag canary
npm publish --provenance --tag canary
echo "Published canary."
curl https://purge.jsdelivr.net/npm/hls.js@canary
curl https://purge.jsdelivr.net/npm/hls.js@canary/dist/hls-demo.js
Expand All @@ -19,7 +19,7 @@ if [[ $(node ./scripts/check-already-published.js) = "not published" ]]; then
exit 1
fi
echo "Publishing tag: ${tag}"
npm publish --tag "${tag}"
npm publish --provenance --tag "${tag}"
curl "https://purge.jsdelivr.net/npm/hls.js@${tag}"
echo "Published."
fi
Expand Down

0 comments on commit a9afcd5

Please sign in to comment.