docker-dind: update fetch_build_tag.sh

This commit is contained in:
Haitao Pan 2024-04-28 00:11:42 +08:00
parent feca12a1e9
commit eb7069f496

View File

@ -17,10 +17,10 @@ BRANCH_NAME=$(git branch --show-current)
# Logic to set the build tag based on branch and tag status
if [[ "$BRANCH_NAME" == "main" ]]; then
echo "BUILD_TAG=latest" >> $GITHUB_ENV
elif [[ "$BRANCH_NAME" =~ ^release/ ]] && [[ -z "$TAG" ]]; then
elif [[ "$BRANCH_NAME" =~ '^release*' ]] && [[ -z "$TAG" ]]; then
PR_ID=$(git log | grep "Merge pull request" | head -n 1 | awk -F# '{print $2}' | awk '{print $1}')
echo "BUILD_TAG=PR-${PR_ID}-$SHORT_COMMIT_ID" >> $GITHUB_ENV
elif [[ "$BRANCH_NAME" =~ ^release/ ]] && [[ ! -z "$TAG" ]]; then
elif [[ "$BRANCH_NAME" =~ '^release*' ]] && [[ ! -z "$TAG" ]]; then
echo "BUILD_TAG=$TAG" >> $GITHUB_ENV
else
JIRA_TICKET=$(git branch | grep '^\*' | awk '{print $2}' | awk -F- '{print $1"-"$2}')