From de7a2b1f884f451742237f4e1910e1d0470ce36a Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo <71768+gionn@users.noreply.github.com> Date: Thu, 8 Aug 2024 10:01:13 +0200 Subject: [PATCH] OPSEXP-2764 Push an additional tag with timestamp (#180) --- .github/workflows/main.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2040f20..f935fa1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -74,6 +74,7 @@ jobs: echo "image_labels=quay.expires-after=2w" >> $GITHUB_OUTPUT fi echo "image_created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + echo "timestamp=$(date -u +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT echo "tomcat_version=$(jq -r .tomcat_version tomcat${{ matrix.tomcat_major }}.json)" >> $GITHUB_OUTPUT echo "tomcat_sha512=$(jq -r .tomcat_sha512 tomcat${{ matrix.tomcat_major }}.json)" >> $GITHUB_OUTPUT @@ -150,10 +151,20 @@ jobs: labels: ${{ steps.vars.outputs.image_labels }} provenance: false - - name: Push Image to docker.io + - name: Push additional timestamped tag to quay.io if: github.ref_name == 'master' env: SRC_IMAGE: quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }} - DST_IMAGE: ${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }} + DST_IMAGE: quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }}-${{ steps.vars.outputs.timestamp }} run: | docker buildx imagetools create ${{ env.SRC_IMAGE }} -t ${{ env.DST_IMAGE }} + + - name: Push images to docker.io + if: github.ref_name == 'master' + env: + SRC_IMAGE: quay.io/${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }} + DST_IMAGE: ${{ env.IMAGE_REGISTRY_NAMESPACE }}/${{ env.IMAGE_REPOSITORY }}:${{ steps.vars.outputs.image_tag }} + run: >- + docker buildx imagetools create ${{ env.SRC_IMAGE }} + -t ${{ env.DST_IMAGE }} + -t ${{ env.DST_IMAGE }}-${{ steps.vars.outputs.timestamp }}