forked from cread/ecks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release
executable file
·63 lines (46 loc) · 998 Bytes
/
release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Find out where we are
BASEDIR=$(cd $(dirname $0) && /bin/pwd)
FORCE=$1
check() {
CMD=$1
shift
GREP="$@"
(cd $BASEDIR && git $CMD) | grep -q "$GREP"
return $?
}
check_status() {
check "status" "^nothing to commit"
if [ $? -eq 1 ]; then
echo "ERROR - Dirty working directory"
return 1
fi
check $1 "status" "^# Your branch is ahead of "
if [ $? -eq 0 ]; then
echo "ERROR - Ahead of origin"
return 1
fi
check $1 "branch" "^* master"
if [ $? -eq 1 ]; then
if [ ! "$FORCE" == "--force" ]; then
echo "ERROR - NOT on master branch"
return 1
else
echo "WARNING - FORCING a release from a non master branch"
fi
fi
}
set +e
check_status
if [ $? -ne 0 ]; then
exit 1
fi
set -e
VER=$(python -c "import ecks; print ecks.__version__")
echo "Releasing version ${VER}"
# Tag
git tag -a "v${VER}" -m "Release version ${VER}"
# Do the release
python setup.py sdist upload
# Push the tags
git push --tags