forked from interlegis/sapl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·51 lines (39 loc) · 1.19 KB
/
release.sh
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
#/bin/bash
VERSION=`git describe --tags --abbrev=0`
LAST_DIGIT=`echo $VERSION | cut -f 3 -d '.'`
MAIN_REV=`echo $VERSION | cut -f 1,2 -d '.'`
NEXT_NUMBER=$(($LAST_DIGIT + 1))
NEXT_VERSION=$MAIN_REV'.'$NEXT_NUMBER
function bump_version {
sed -e s/$VERSION/$NEXT_VERSION/g docker-compose.yml > tmp1
mv tmp1 docker-compose.yml
sed -e s/$VERSION/$NEXT_VERSION/g setup.py > tmp2
mv tmp2 setup.py
sed -e s/$VERSION/$NEXT_VERSION/g sapl/templates/base.html > tmp3
mv tmp3 sapl/templates/base.html
sed -e s/$VERSION/$NEXT_VERSION/g sapl/settings.py > tmp4
mv tmp4 sapl/settings.py
}
function commit_and_push {
echo "committing..."
git add docker-compose.yml setup.py sapl/settings.py sapl/templates/base.html
git commit -m "Release: $NEXT_VERSION"
git tag $NEXT_VERSION
echo "sending to github..."
git push origin $NEXT_VERSION
git push origin
echo "done."
}
case "$1" in
--dry-run)
echo "Dry run"
bump_version
echo "done."
echo "Run git checkout -- docker-compose.yml setup.py to undo the files"
exit 0
;;
--publish)
echo "generating release"
bump_version
commit_and_push
esac