45
45
needs : [changes]
46
46
if : needs.changes.outputs.should-run-build == 'true'
47
47
name : Build Image
48
+ permissions :
49
+ contents : read
50
+ id-token : write
51
+ packages : write
52
+ attestations : write
48
53
strategy :
49
54
matrix :
50
55
image_type : [alpine, debian]
@@ -129,6 +134,7 @@ jobs:
129
134
run : echo "RELEASE_VERSION=${{ startsWith(github.ref, 'refs/tags/') && '${GITHUB_REF#refs/*/}' || 'dev' }}" >> $GITHUB_ENV
130
135
131
136
- name : " Build ${{ env.PUSH == 'true' && 'and push' || '' }} ${{ env.DOCKER_REPO }} image"
137
+ id : build
132
138
if : contains(fromJson('["push", "pull_request"]'), github.event_name)
133
139
uses : docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
134
140
with :
@@ -147,6 +153,14 @@ jobs:
147
153
labels : ${{ steps.meta.outputs.labels }}
148
154
outputs : type=image,name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
149
155
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
+
150
164
test :
151
165
needs : [changes]
152
166
if : needs.changes.outputs.should-run-build == 'true'
@@ -201,4 +215,4 @@ jobs:
201
215
image_type : [alpine, debian]
202
216
runs-on : ubuntu-24.04
203
217
steps :
204
- - run : ' echo "No build required"'
218
+ - run : ' echo "No build required"'
0 commit comments