Skip to content

Instantly share code, notes, and snippets.

@ashrafuzzaman
Created July 28, 2015 08:48
Show Gist options
  • Save ashrafuzzaman/6c39a7321933179af7eb to your computer and use it in GitHub Desktop.
Save ashrafuzzaman/6c39a7321933179af7eb to your computer and use it in GitHub Desktop.
Create an automated tag
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