Created
July 28, 2015 08:48
-
-
Save ashrafuzzaman/6c39a7321933179af7eb to your computer and use it in GitHub Desktop.
Create an automated tag
This file contains 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 "Fetching tags ..." | |
git fetch newscred --tags | |
VERSION="$(git describe --abbrev=0 --tags)" | |
echo "Latest tag" $VERSION | |
#replace . with space so can split into an array | |
VERSION_BITS=(${VERSION//./ }) | |
#get number parts and increase last one by 1 | |
VNUM1=${VERSION_BITS[0]} | |
VNUM2=${VERSION_BITS[1]} | |
VNUM3=${VERSION_BITS[2]} | |
VNUM4=${VERSION_BITS[3]} | |
VNUM4=$((VNUM4+1)) | |
#create new tag | |
NEW_TAG="$VNUM1.$VNUM2.$VNUM3.$VNUM4" | |
git tag $NEW_TAG | |
echo "Pushing" $NEW_TAG | |
git push newscred $NEW_TAG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment