File: postcommit-hook.sh

package info (click to toggle)
sqlmap 1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 11,620 kB
  • ctags: 4,964
  • sloc: python: 48,383; xml: 15,395; ansic: 989; sh: 268; makefile: 60; sql: 57; perl: 30; cpp: 27; asm: 7
file content (23 lines) | stat: -rw-r--r-- 706 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

SETTINGS="../../lib/core/settings.py"

declare -x SCRIPTPATH="${0}"

FULLPATH=${SCRIPTPATH%/*}/$SETTINGS

if [ -f $FULLPATH ]
then
    LINE=$(grep -o ${FULLPATH} -e 'VERSION = "[0-9.]*"')
    declare -a LINE
    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")
    if [ -n "$NEW_TAG" ]
    then
        git commit -am "Automatic monthly tagging"
        echo "Creating new tag ${NEW_TAG}"
        git tag $NEW_TAG
        git push origin $NEW_TAG
        echo "Going to push PyPI package"
        /bin/bash ${SCRIPTPATH%/*}/pypi.sh
    fi
fi