Path: blob/master/extra/shutils/postcommit-hook.sh
2992 views
#!/bin/bash12: '3cat > .git/hooks/post-commit << EOF4#!/bin/bash56source ./extra/shutils/postcommit-hook.sh7EOF89chmod +x .git/hooks/post-commit10'1112SETTINGS="../../lib/core/settings.py"13PYPI="../../extra/shutils/pypi.sh"1415declare -x SCRIPTPATH="${0}"1617FULLPATH=${SCRIPTPATH%/*}/$SETTINGS1819if [ -f $FULLPATH ]20then21LINE=$(grep -o ${FULLPATH} -e 'VERSION = "[0-9.]*"')22declare -a LINE23NEW_TAG=$(python -c "import re, sys, time; version = re.search('\"([0-9.]*)\"', sys.argv[1]).group(1); _ = version.split('.'); print '.'.join(_[:-1]) if len(_) == 4 and _[-1] == '0' else ''" "$LINE")24if [ -n "$NEW_TAG" ]25then26#git commit -am "Automatic monthly tagging"27echo "Creating new tag ${NEW_TAG}"28git tag $NEW_TAG29git push origin $NEW_TAG30echo "Going to push PyPI package"31/bin/bash ${SCRIPTPATH%/*}/$PYPI32fi33fi343536