Skip to content

Commit

Permalink
ci: add provenance to all published packages (#25)
Browse files Browse the repository at this point in the history
This commit adds provenance for all published packages. See the NPM documentation [0].

Provenance will allow people to verify that the packages were actually built on GH Actions and with the content of the corresponding commit. This will help with supply chain security.

For this to work, the `id-token` permission was added only where necessary.

[0]: https://docs.npmjs.com/generating-provenance-statements
  • Loading branch information
saibotk committed Mar 22, 2024
1 parent 000b61b commit f8d4307
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/release-insiders.yml
Expand Up @@ -4,6 +4,10 @@ on:
push:
branches: [main]

permissions:
contents: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -45,6 +49,6 @@ jobs:
run: npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version

- name: Publish
run: npm publish --tag insiders
run: npm publish --provenance --tag insiders
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Expand Up @@ -6,6 +6,7 @@ on:

permissions:
contents: read
id-token: write

jobs:
build:
Expand Down Expand Up @@ -44,6 +45,6 @@ jobs:
echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
- name: Publish
run: npm publish --tag ${{ env.RELEASE_CHANNEL }}
run: npm publish --provenance --tag ${{ env.RELEASE_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit f8d4307

Please sign in to comment.