Created
February 28, 2022 09:32
-
-
Save chbatey/3a8db660d0735af81292aac582f593a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Checking if the commit is already tagged" | |
if ! git describe --tag --exact-match 2>&1 | grep "fatal"; | |
then | |
echo "Commit is already tagged" | |
exit 0 | |
fi | |
echo "Getting previous tag" | |
CURRENT_TAG=$$(git describe --tag --abbrev=0) | |
if [ "$${CURRENT_TAG}" = "" ] | |
then | |
echo "Can't find any tags" | |
NEW_TAG="v1.0.0" | |
else | |
echo "Increment minor version" | |
NEW_TAG=$$(echo "$${CURRENT_TAG}" | awk -F'[v.]' '{print "v"$$2"."$$3+1"."$$4}') | |
fi | |
echo "Current tag is $${CURRENT_TAG}" | |
echo "New tag is $${NEW_TAG}" | |
echo "Pushing new tag" | |
git tag "$${NEW_TAG}" | |
git push origin "$${NEW_TAG}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment