From d9088280f88ba2f0199878d27ae567057623a1ea Mon Sep 17 00:00:00 2001 From: pvincent Date: Thu, 25 May 2023 19:08:19 +0400 Subject: [PATCH] fix: semver_git_tag on current branch --- tools/semver_git_tag | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/semver_git_tag b/tools/semver_git_tag index 9e1a67b..b9b6538 100755 --- a/tools/semver_git_tag +++ b/tools/semver_git_tag @@ -54,11 +54,12 @@ if [[ ! $changed -eq 0 ]]; then exit 3 fi +current_branch=$(git rev-parse --abbrev-ref HEAD) # check if push needed before tagging push_needed=$(git rev-list --branches --not --remotes | wc -l) if [[ $push_needed -ne 0 ]]; then echo 'git push needed' - git push --set-upstream origin master + git push --set-upstream origin "$current_branch" echo 'git push done' echo '-------------' fi @@ -86,7 +87,7 @@ if [[ $VERSION != '0.0.0' ]]; then COMMIT_ID=$(git log --format="%H" -n 1) if [[ $COMMIT_ID == $LAST_TAG ]]; then echo "cannot tag twice the same commit id : $LAST_TAG" - exit -1 + exit 1 fi fi @@ -145,5 +146,5 @@ git add ${GIT_ROOT_FOLDER}/.semver_git_tag echo "tagging as $TAG ..." git commit -am "tagged as ${TAG}" git tag $TAG -git push origin master --tags -echo done +git push origin "$current_branch" --tags +echo "done"