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
| #!/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