fix(docker): use inputs.tag to detect workflow_call context (#996)

In a reusable workflow, github.event_name inherits the caller's
event (e.g. "push"), not "workflow_call". This caused the
type=raw tag to be disabled when docker.yml was called from
release-candidate.yml, producing no Docker tags at all and
failing the build.

Fix: check `inputs.tag != ''` instead, since inputs.tag is only
populated for workflow_call invocations.

Co-authored-by: wangjichao <wangjichao@inke.cn>
This commit is contained in:
evolution 2026-04-21 01:20:57 +08:00 • committed by GitHub
parent ceb3221921
commit b20d29bded

View file

@ -135,6 +135,9 @@ jobs:
# the type=semver patterns would not match. In that case we add an explicit
# type=raw tag using the version already verified above, so the same
# image-naming rules apply regardless of how the workflow was triggered.
# NOTE: We check `inputs.tag` rather than `github.event_name` because in a
# reusable workflow the github context is inherited from the caller —
# `github.event_name` would still be "push", not "workflow_call".
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
@ -145,7 +148,7 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=${{ steps.version.outputs.version }},enable=${{ github.event_name == 'workflow_call' }}
type=raw,value=${{ steps.version.outputs.version }},enable=${{ inputs.tag != '' }}
- name: Build and push
id: build