Created
May 17, 2018 10:34
-
-
Save lfaoro/711e92d8ce6885961d336c5af0fb7b65 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
#!/usr/bin/env bash | |
BASE=(`cat VERSION | tr '.' ' '`) | |
MAJOR=${BASE[0]} | |
MINOR=${BASE[1]} | |
PATCH=${BASE[2]} | |
case $1 in | |
"major") | |
let "MAJOR++" | |
MINOR=0 | |
PATCH=0 | |
;; | |
"minor") | |
let "MINOR++" | |
PATCH=0 | |
;; | |
"patch") | |
let "PATCH++" | |
;; | |
*) | |
echo " | |
Usage: ./bump.sh major|minor|patch | |
" | |
esac | |
VER="$MAJOR.$MINOR.$PATCH" | |
echo "Bumping version from `cat VERSION` to $VER" | |
read -p "[enter] to confirm / [ctrl-c] to cancel" -n 1 -r | |
echo $VER > VERSION | |
git checkout -b "release-v$VER" | |
git add VERSION | |
git commit -m "Bumped version to v$VER" | |
git tag -a -m "Tag version v$VER." "v$VER" | |
git push -u origin "release-v$VER" | |
git push origin --tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment