Merge pull request #39 from svc-design/build-ci-image-docker-dind

docker-dind: Refined branch name pattern matching release branch
This commit is contained in:
shenlan 2024-04-28 00:34:01 +08:00 committed by GitHub
commit 6130ff00d2

View File

@ -19,10 +19,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" =~ ^(r|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" =~ ^(r|release).* ]] && [[ ! -z "$TAG" ]]; then
echo "BUILD_TAG=$TAG" >> $GITHUB_ENV
else
JIRA_TICKET=$(git branch | grep '^\*' | awk '{print $2}' | awk -F- '{print $1"-"$2}')