]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Builder-dispatch: Generate provenance for built artifacts
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 16 Feb 2023 10:26:42 +0000 (11:26 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 27 Jun 2023 11:40:58 +0000 (13:40 +0200)
.github/workflows/builder-dispatch.yml

index 4db7f7e46f11b1c948c2c7bf23b4ed57943a77d5..538e4e35111b56c493fcb9febdd1effe9c05fa22 100644 (file)
@@ -60,6 +60,8 @@ jobs:
       matrix:
         os: ${{fromJson(needs.prepare.outputs.oslist)}}
       fail-fast: false
+    outputs:
+      hashes: ${{ steps.hash.outputs.hashes }}
     steps:
       - uses: actions/checkout@v3
         with:
@@ -77,16 +79,33 @@ jobs:
           name: ${{ github.event.inputs.product }}-${{ matrix.os }}-${{ steps.getversion.outputs.version }}
           path: built_pkgs/
           retention-days: 7
+      - name: Generate hashes for provenance
+        shell: bash
+        id: hash
+        run: |
+          echo "hashes=$(sha256sum ./built_pkgs/*/*/* | base64 -w0)" >> $GITHUB_OUTPUT
       - name: Upload packages to downloads.powerdns.com
         env:
           SSHKEY: ${{ secrets.DOWNLOADS_AUTOBUILT_SECRET }}
           RSYNCTARGET: ${{ secrets.DOWNLOADS_AUTOBUILT_RSYNCTARGET }}
           HOSTKEY: ${{ secrets.DOWNLOADS_AUTOBUILT_HOSTKEY }}
         if:
-          "${{ env.SSHKEY != '' }}"          
+          "${{ env.SSHKEY != '' }}"
         run: |
           mkdir -m 700 -p ~/.ssh
           echo "$SSHKEY" > ~/.ssh/id_ed25519
           chmod 600 ~/.ssh/id_ed25519
           echo "$HOSTKEY" > ~/.ssh/known_hosts
           rsync -4rlptD built_pkgs/* "$RSYNCTARGET"
+
+  provenance:
+    needs: build
+    name: Generate build provenance
+    permissions:
+      actions: read   # To read the workflow path.
+      id-token: write # To sign the provenance.
+      contents: write # To be able to upload assets as release artifacts
+    uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.4.0
+    with:
+      base64-subjects: "${{ needs.build.outputs.hashes }}"
+      upload-assets: false