refactor: simplify tag determination logic in build workflow

This commit is contained in:
XargonWan 2025-03-29 10:24:04 +09:00
parent 1cdf81aab0
commit 654b717d1e

View file

@ -117,18 +117,14 @@ jobs:
fi
# Determine the tag based on the GitHub event context
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
# Main branch tag
TAG="$VERSION"
MAKE_LATEST=true
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
if [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
# Pull request tag, sanitize the source branch
source_branch="${GITHUB_HEAD_REF//\//-}"
TAG="PR-$source_branch-${{ github.run_id }}"
MAKE_LATEST=false
else
# Other branches (cooker branches)
TAG="$VERSION-${{ env.BUILD_ID }}"
# Other branches (cooker, main branches)
TAG="$VERSION"
MAKE_LATEST=true
fi