Skip to content

Commit 91574ef

Browse files
authored
feat: add image attestation workflow step (#5158)
Signed-off-by: Dan Urson <[email protected]>
1 parent 9cfc777 commit 91574ef

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/atlantis-image.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ jobs:
4545
needs: [changes]
4646
if: needs.changes.outputs.should-run-build == 'true'
4747
name: Build Image
48+
permissions:
49+
contents: read
50+
id-token: write
51+
packages: write
52+
attestations: write
4853
strategy:
4954
matrix:
5055
image_type: [alpine, debian]
@@ -129,6 +134,7 @@ jobs:
129134
run: echo "RELEASE_VERSION=${{ startsWith(github.ref, 'refs/tags/') && '${GITHUB_REF#refs/*/}' || 'dev' }}" >> $GITHUB_ENV
130135

131136
- name: "Build ${{ env.PUSH == 'true' && 'and push' || '' }} ${{ env.DOCKER_REPO }} image"
137+
id: build
132138
if: contains(fromJson('["push", "pull_request"]'), github.event_name)
133139
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
134140
with:
@@ -147,6 +153,14 @@ jobs:
147153
labels: ${{ steps.meta.outputs.labels }}
148154
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
149155

156+
- name: "Sign and Attest Image"
157+
if: env.PUSH == 'true'
158+
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
159+
with:
160+
subject-digest: ${{ steps.build.outputs.digest }}
161+
subject-name: ghcr.io/${{ github.repository }}
162+
push-to-registry: true
163+
150164
test:
151165
needs: [changes]
152166
if: needs.changes.outputs.should-run-build == 'true'
@@ -201,4 +215,4 @@ jobs:
201215
image_type: [alpine, debian]
202216
runs-on: ubuntu-24.04
203217
steps:
204-
- run: 'echo "No build required"'
218+
- run: 'echo "No build required"'

0 commit comments

Comments
 (0)