From 94fedf41b68ebb58a32b9ddecde507a239ae5c7d Mon Sep 17 00:00:00 2001 From: Mogyuchi Date: Tue, 3 Sep 2024 23:00:02 +0900 Subject: [PATCH] ci: display image digest on the job summary (#532) --- .github/workflows/docker-publish.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index a8deeb98..eebf11b6 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -63,7 +63,8 @@ jobs: EOF EOS - - name: Build and push Docker image + - id: build-push + name: Build and push Docker image uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0 with: context: . @@ -73,3 +74,15 @@ jobs: labels: ${{ steps.labels.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + + - if: ${{ github.event_name != 'pull_request' }} + name: Display image digest + env: + NAME: ${{ fromJson(steps.build-push.outputs.metadata)['image.name'] }} + DIGEST: ${{ fromJson(steps.build-push.outputs.metadata)['containerimage.digest'] }} + run: | + name=$(cut --delimiter=',' --fields=1 <<< "$NAME") + + echo '```' >> $GITHUB_STEP_SUMMARY + echo "$name@$DIGEST" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY