Skip to content

Commit 05ed845

Browse files
author
Val Brodsky
committed
Add provenance support
1 parent eb0d74d commit 05ed845

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/lbox-publish.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
build:
4545
runs-on: ubuntu-latest
4646
needs: ['path-filter', 'test-build']
47+
outputs:
48+
hashes: ${{ steps.hash.outputs.hashes }}
4749
strategy:
4850
fail-fast: false
4951
matrix:
@@ -66,10 +68,37 @@ jobs:
6668
run: |
6769
rye sync
6870
rye build
71+
- name: "Generate hashes"
72+
id: hash
73+
run: |
74+
cd dist && echo "hashes-${{matrix.package}}=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
6975
- uses: actions/upload-artifact@v4
7076
with:
7177
name: build-${{ matrix.package }}
7278
path: ./dist
79+
provenance_python:
80+
needs: [path-filter, build]
81+
runs-on: ubuntu-latest
82+
strategy:
83+
fail-fast: false
84+
matrix:
85+
include: ${{ fromJSON(needs.path-filter.outputs.package-matrix) }}
86+
permissions:
87+
actions: read
88+
contents: write
89+
id-token: write # Needed to access the workflow's OIDC identity.
90+
steps:
91+
- name: Use hashes output
92+
id: use-hashes
93+
run: |
94+
HASH_VAR="hashes-${{ matrix.package }}"
95+
echo "HASH_VAR=$HASH_VAR" >> $GITHUB_ENV
96+
echo "Using hash: ${{ env.HASH_VAR }}"
97+
- uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
98+
with:
99+
base64-subjects: "${{ env.HASH_VAR }}"
100+
upload-assets: true
101+
upload-tag-name: v.6.0.0 # Tag from the initiation of the workflow
73102
test-build:
74103
needs: ['path-filter']
75104
if: ${{ needs.path-filter.outputs.lbox == 'true' }}

0 commit comments

Comments
 (0)