fix(workflows): prefer caller tag in do-release resolution
Handle Teacup workflow_call input forwarding gaps by using needs.prepare.outputs.tag as a fallback and normalizing %touch docker-compose.yml(string=...) wrappers before selecting the release tag.
This commit is contained in:
@@ -59,16 +59,40 @@ jobs:
|
||||
id: resolve-version
|
||||
env:
|
||||
INPUT_TAG: ${{ inputs.tag }}
|
||||
CALLER_TAG: ${{ needs.prepare.outputs.tag }}
|
||||
DETECTED_TAG: ${{ steps.detect-tag.outputs.detected_tag }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
# Try to use explicit input first
|
||||
requested_tag="$(printf '%s' "${INPUT_TAG}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||
normalize_candidate() {
|
||||
local raw="$1"
|
||||
|
||||
raw="$(printf '%s' "$raw" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||
|
||||
# Teacup can surface expression strings as %!t(string=value); unwrap it.
|
||||
if [[ "$raw" =~ ^%\!t\(string=(.*)\)$ ]]; then
|
||||
raw="${BASH_REMATCH[1]}"
|
||||
fi
|
||||
|
||||
raw="$(printf '%s' "$raw" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||
printf '%s' "$raw"
|
||||
}
|
||||
|
||||
input_tag="$(normalize_candidate "${INPUT_TAG}")"
|
||||
caller_tag="$(normalize_candidate "${CALLER_TAG}")"
|
||||
detected_tag="$(normalize_candidate "${DETECTED_TAG}")"
|
||||
|
||||
# Try explicit input first.
|
||||
requested_tag="$input_tag"
|
||||
|
||||
# Fall back to caller workflow output when workflow_call input forwarding is unreliable.
|
||||
if [[ -z "$requested_tag" && -n "$caller_tag" ]]; then
|
||||
requested_tag="$caller_tag"
|
||||
fi
|
||||
|
||||
# Fall back to detected tag if input is empty
|
||||
if [[ -z "$requested_tag" && -n "${DETECTED_TAG}" ]]; then
|
||||
requested_tag="$DETECTED_TAG"
|
||||
# Fall back to detected tag if neither input nor caller tag is available.
|
||||
if [[ -z "$requested_tag" && -n "$detected_tag" ]]; then
|
||||
requested_tag="$detected_tag"
|
||||
fi
|
||||
|
||||
# Try GITHUB_REF if still empty
|
||||
@@ -82,8 +106,9 @@ jobs:
|
||||
tag="v${normalized}"
|
||||
else
|
||||
echo "Error: Could not resolve release version" >&2
|
||||
echo " - inputs.tag: '$INPUT_TAG'" >&2
|
||||
echo " - detected_tag: '${DETECTED_TAG}'" >&2
|
||||
echo " - inputs.tag(raw): '$INPUT_TAG'" >&2
|
||||
echo " - needs.prepare.outputs.tag(raw): '$CALLER_TAG'" >&2
|
||||
echo " - detected_tag(raw): '${DETECTED_TAG}'" >&2
|
||||
echo " - GITHUB_REF: '$GITHUB_REF'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user