From ff1e128f0e6617bcc7782612b85d0d37138a2d6f Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 9 May 2026 17:28:54 +0300 Subject: [PATCH] Fix versioned image publish under workflow_run trigger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit e978d3c switched the publish trigger from `push` to `workflow_run` and correctly migrated the `type=raw,value=latest` rule to read the upstream head_branch from `github.event.workflow_run.*` — but left the `type=semver,pattern={{raw}}` rule unchanged. That rule still reads `github.ref`, which under workflow_run dispatch is always `refs/heads/main` (the default branch where the workflow file lives), not the triggering tag ref. As a result, no semver tag was extracted, metadata-action produced no tags, and `buildx` failed with "tag is needed when pushing to registry". The `latest` tag kept publishing because its rule was migrated; versioned tags (v1.19.0, v1.19.1) silently stopped publishing. Pass the upstream head_branch to the semver rule explicitly via `value`, gated by `enable` so it only fires for v* tags. Mirrors the migration the raw rule already received. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 89807d3..e90d57a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -34,7 +34,7 @@ jobs: ghcr.io/${{ github.repository }} tags: | type=raw,value=latest,enable=${{ github.event.workflow_run.head_branch == 'main' }} - type=semver,pattern={{raw}} + type=semver,pattern={{raw}},value=${{ github.event.workflow_run.head_branch }},enable=${{ startsWith(github.event.workflow_run.head_branch || '', 'v') }} docker-build: if: | @@ -77,7 +77,7 @@ jobs: with: tags: | type=raw,value=latest,enable=${{ github.event.workflow_run.head_branch == 'main' }} - type=semver,pattern={{raw}} + type=semver,pattern={{raw}},value=${{ github.event.workflow_run.head_branch }},enable=${{ startsWith(github.event.workflow_run.head_branch || '', 'v') }} flavor: | latest=auto suffix=-${{ matrix.arch }},onlatest=true