From 41afa0fb233f023e05ed3eb91f44de3eeb15b7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Wed, 27 Nov 2024 16:46:54 +0100 Subject: [PATCH] Tag before upload to have the same container digest --- .github/workflows/release-container-image.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-container-image.yml b/.github/workflows/release-container-image.yml index 626bbf4..4210eed 100644 --- a/.github/workflows/release-container-image.yml +++ b/.github/workflows/release-container-image.yml @@ -1,7 +1,7 @@ # This action listens on new tags, generates a new container image # sign it and upload it to the container registry. -name: Publish container image +name: Release container image on: push: tags: @@ -40,11 +40,15 @@ jobs: sudo apt-get install -y python3-poetry python3 ./install/common/build-image.py echo ${{ github.token }} | podman login ghcr.io -u USERNAME --password-stdin + + # Load the image with the final name directly gunzip -c share/container.tar.gz | podman load - podman push \ - dangerzone.rocks/dangerzone \ - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - DIGEST=$(podman images --filter "reference=dangerzone.rocks/dangerzone" --format "{{ .Digest }}") + FINAL_IMAGE_NAME="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" + podman tag dangerzone.rocks/dangerzone "$FINAL_IMAGE_NAME" + podman push "$FINAL_IMAGE_NAME" + + # Get digest of the pushed image using the final name + DIGEST=$(podman inspect --format='{{.Digest}}' "$FINAL_IMAGE_NAME") echo "Digest: ${DIGEST}" echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"