Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/extra/shutils/postcommit-hook.sh
2992 views
1
#!/bin/bash
2
3
: '
4
cat > .git/hooks/post-commit << EOF
5
#!/bin/bash
6
7
source ./extra/shutils/postcommit-hook.sh
8
EOF
9
10
chmod +x .git/hooks/post-commit
11
'
12
13
SETTINGS="../../lib/core/settings.py"
14
PYPI="../../extra/shutils/pypi.sh"
15
16
declare -x SCRIPTPATH="${0}"
17
18
FULLPATH=${SCRIPTPATH%/*}/$SETTINGS
19
20
if [ -f $FULLPATH ]
21
then
22
LINE=$(grep -o ${FULLPATH} -e 'VERSION = "[0-9.]*"')
23
declare -a LINE
24
NEW_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")
25
if [ -n "$NEW_TAG" ]
26
then
27
#git commit -am "Automatic monthly tagging"
28
echo "Creating new tag ${NEW_TAG}"
29
git tag $NEW_TAG
30
git push origin $NEW_TAG
31
echo "Going to push PyPI package"
32
/bin/bash ${SCRIPTPATH%/*}/$PYPI
33
fi
34
fi
35
36