Created
March 21, 2015 03:58
-
-
Save grepper/6f99cb666fb23dec813e 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 | |
| # .git/hooks/post-commit | |
| githome="/home/robert/git/projects/tovid" | |
| cd "$githome" | |
| # only run when we are on master branch | |
| # a release branch will have the version hard-coded | |
| Status=$(git status | awk '{ print $NF ; exit }') | |
| [[ $Status == "master" ]] || exit 0 | |
| Setup="$githome/setup.py" | |
| Tag=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
| Sha=$(git describe --always) | |
| Version=$(sed -n "s/_last_release = '\(.*\)'/\1/p" "$githome/setup.py") | |
| Version=${Version}+${Sha} | |
| # change _tovid_version in setup.py | |
| sed -i "s/^_tovid_version.*/_tovid_version = '$Version'/" "$Setup" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment