diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 402d99fb..993f9729 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,6 +28,7 @@ jobs: outputs: version: ${{ steps.extract-version.outputs.version }} + version-forelast: ${{ steps.extract-version-forelast.outputs.version }} branch: ${{ steps.extract-branch.outputs.branch }} steps: @@ -40,6 +41,12 @@ jobs: git fetch --prune --tags echo "version=`git tag -l --points-at=HEAD | sed -En 's/^v(.*)/\1/p'`" >> $GITHUB_OUTPUT + - name: Get version tag of HEAD~1 if any + id: extract-version-forelast + run: | + git fetch --prune --tags + echo "version-forelast=`git tag -l --points-at=HEAD~1 | sed -En 's/^v(.*)/\1/p'`" >> $GITHUB_OUTPUT + - name: Extract branch name id: extract-branch shell: bash @@ -51,7 +58,7 @@ jobs: build-and-push-image: runs-on: ubuntu-latest needs: prerequisites - if: github.event.pull_request.merged == true && needs.prerequisites.outputs.version == '' + if: github.event.pull_request.merged == true && needs.prerequisites.outputs.version == '' && needs.prerequisites.outputs.version-forelast == '' strategy: matrix: @@ -118,7 +125,7 @@ jobs: retag-and-push-image: runs-on: ubuntu-latest needs: prerequisites - if: github.event.pull_request.merged == true && needs.prerequisites.outputs.version != '' + if: github.event.pull_request.merged == true && needs.prerequisites.outputs.version-forelast != '' steps: - name: Login to Docker registry