Browse Source

fix: semver_git_tag on current branch

master
pvincent 1 year ago
parent
commit
d9088280f8
  1. 9
      tools/semver_git_tag

9
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"
Loading…
Cancel
Save