Skip to content

Commit

Permalink
CI: Add provenance to publised packages (#3023)
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 headlessui 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 authored Mar 12, 2024
1 parent 79b0330 commit 5a85d80
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -53,7 +57,7 @@ jobs:
run: npm version -w packages 0.0.0-insiders.${{ steps.vars.outputs.sha_short }} --force --no-git-tag-version

- name: Publish
run: npm publish -w packages --tag insiders
run: npm publish -w packages --provenance --tag insiders
env:
CI: true
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ concurrency:

permissions:
contents: read
id-token: write

env:
CI: true
Expand Down Expand Up @@ -58,6 +59,6 @@ jobs:
echo "PACKAGE_PATH=$(npm run package-path $TAG_NAME --silent)" >> $GITHUB_ENV
- name: Publish
run: npm publish ${{ env.PACKAGE_PATH }} --tag ${{ env.RELEASE_CHANNEL }}
run: npm publish ${{ env.PACKAGE_PATH }} --provenance --tag ${{ env.RELEASE_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 5a85d80

Please sign in to comment.