CI: Add provenance to publised packages (#3023)

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
This commit is contained in:
saibotk
2024-03-12 15:32:15 +01:00
committed by GitHub
parent 79b03303c5
commit 5a85d8089a
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -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
@@ -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 }}
+2 -1
View File
@@ -10,6 +10,7 @@ concurrency:
permissions:
contents: read
id-token: write
env:
CI: true
@@ -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 }}