From 6603619931c72964a316d699fc96b5d854874619 Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Tue, 3 Sep 2024 17:56:26 +0200 Subject: [PATCH] docker image with git sha only for pushes on main branch Signed-off-by: Eguzki Astiz Lezaun --- .github/workflows/build-image.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index 3871a69e..c64a4a7c 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -5,9 +5,10 @@ on: push: branches: ['*'] tags: ['*'] + workflow_dispatch: {} env: - IMG_TAGS: ${{ github.sha }} ${{ github.ref_name }} + IMG_TAGS: ${{ github.ref_name }} IMG_REGISTRY_HOST: quay.io IMG_REGISTRY_ORG: kuadrant MAIN_BRANCH_NAME: main @@ -19,11 +20,16 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 - - name: Add latest tag + - name: Add latest tag for the main branch if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} id: add-latest-tag run: | echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV + - name: Add git sha tag for the main branch + if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} + id: add-git-sha-tag + run: | + echo "IMG_TAGS=${{ github.sha }} ${{ env.IMG_TAGS }}" >> $GITHUB_ENV - name: Build Image id: build-image uses: redhat-actions/buildah-build@v2