Skip to content

Commit b282e1a

Browse files
✨ add attestations to image build
1 parent 1dcac08 commit b282e1a

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

.github/workflows/build-push-images.yaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ jobs:
7272
build:
7373
needs: [ prepare ]
7474
runs-on: ubuntu-latest
75+
permissions:
76+
id-token: write
77+
contents: read
78+
attestations: write
79+
packages: write
7580
env:
7681
tag: ${{ needs.prepare.outputs.tag }}
7782
strategy:
@@ -162,9 +167,27 @@ jobs:
162167
password: ${{ secrets.registry_password }}
163168
registry: ${{ inputs.registry }}
164169

170+
- name: Log in to registry
171+
uses: redhat-actions/podman-login@main
172+
with:
173+
username: ${{ secrets.registry_username }}
174+
password: ${{ secrets.registry_password }}
175+
registry: ${{ inputs.registry }}
176+
- name: Generate artifact attestation
177+
uses: actions/attest-build-provenance@v2
178+
with:
179+
subject-name: ${{ inputs.registry }}/${{ steps.build.outputs.image }}
180+
subject-digest: ${{ steps.push.outputs.digest }}
181+
push-to-registry: true
182+
165183
manifest:
166184
needs: [ prepare, build ]
167185
runs-on: ubuntu-latest
186+
permissions:
187+
id-token: write
188+
contents: read
189+
attestations: write
190+
packages: write
168191
env:
169192
tag: ${{ needs.prepare.outputs.tag }}
170193
steps:
@@ -193,4 +216,11 @@ jobs:
193216
tags: ${{ env.tag }}
194217
username: ${{ secrets.registry_username }}
195218
password: ${{ secrets.registry_password }}
196-
registry: ${{ inputs.registry }}
219+
registry: ${{ inputs.registry }}
220+
221+
- name: Generate artifact attestation
222+
uses: actions/attest-build-provenance@v2
223+
with:
224+
subject-name: ${{ inputs.registry }}/${{ inputs.image_name }}
225+
subject-digest: ${{ steps.push.outputs.digest }}
226+
push-to-registry: true

0 commit comments

Comments
 (0)