File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 5252 required : false
5353 password :
5454 required : false
55-
55+ outputs :
56+ checksum :
57+ description : " Checksum of the Docker image"
58+ value : ${{ jobs.build.outputs.checksum }}
5659jobs :
5760 build :
5861 runs-on : ubuntu-latest
62+ outputs :
63+ checksum : ${{ steps.checksum.outputs.checksum }}
5964
6065 # avoid shell injection through string interpolation
6166 env :
@@ -226,7 +231,15 @@ jobs:
226231 - name : Push Docker image
227232 if : ${{ inputs.push }}
228233 run : docker push "$OCI_IMAGE"
229-
234+
235+ - name : Compute checksum of the Docker image
236+ id : checksum
237+ run : |
238+ # Extract SHA256 digest and format as 0X...
239+ INSPECT=$(docker image inspect "$OCI_IMAGE")
240+ DIGEST=$(echo "$INSPECT" | jq -r 'if .[0].RepoDigests[0] then .[0].RepoDigests[0] | split("@sha256:")[1] else .[0].Id | split(":")[1] end')
241+ echo "checksum=0X${DIGEST}" >> "$GITHUB_OUTPUT"
242+
230243 - name : Cleanup files
231244 if : always()
232245 run : |
You can’t perform that action at this time.
0 commit comments