diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c893263..e66b16c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -7,6 +7,9 @@ on: pull_request: branches: - main + workflow_run: + workflows: [ "Auto Tag with SemVer" ] + types: [ completed ] workflow_dispatch: jobs: @@ -24,7 +27,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Docker Registry - if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch' + if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run' uses: docker/login-action@v3 with: registry: ghcr.io @@ -54,7 +57,7 @@ jobs: # Extract the git tag for the checked out commit, or blank string if it does not have one - name: Get commit tag - if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch' + if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run' run: | TAG=$(git describe --tags --exact-match || echo "") echo "LATEST_TAG=$TAG" >> $GITHUB_ENV @@ -67,10 +70,10 @@ jobs: tags: | type=ref,event=tag type=raw,value=latest - type=semver,pattern={{version}},value=${{ env.LATEST_TAG }},enable=${{github.event_name == 'workflow_dispatch'}} + type=semver,pattern={{version}},value=${{ env.LATEST_TAG }},enable=${{ env.LATEST_TAG != '' }} - name: Push cached image to container registry - if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch' + if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run' uses: docker/build-push-action@v6 env: DOCKER_BUILD_RECORD_UPLOAD: false