-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·65 lines (49 loc) · 1.51 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
if [ ! -d ./.git ]
then
echo "not in root directory"
exit 1
fi
if [ ! -z "$(git status --porcelain)" ]
then
echo "working tree is not clean"
exit 1
fi
aws sts get-caller-identity
git checkout master
git pull
VERSION="$(cat ./common.mk | egrep '^VERSION=')"
# check that the version is formatted as we expect
echo "$VERSION" | egrep '^VERSION=[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT$'
VERSION="$(echo "$VERSION" | gcut -d "=" -f 2)"
VERSION="$(echo "$VERSION" | gcut -d "-" -f 1)"
VERSION_MAJOR="$(echo "$VERSION" | gcut -d "." -f 1)"
VERSION_MINOR="$(echo "$VERSION" | gcut -d "." -f 2)"
VERSION_PATCH="$(echo "$VERSION" | gcut -d "." -f 3)"
function set_version()
{
gsed -i -e 's/^VERSION=.*$/VERSION='"$1"'/' ./common.mk
}
if [ "$VERSION_PATCH" != "0" ]
then
echo "patchlevel is not zero"
exit 1
fi
VERSION_THIS="$VERSION_MAJOR"."$VERSION_MINOR"."$VERSION_PATCH"
VERSION_NEXT="$VERSION_MAJOR"."$(( (VERSION_MINOR + 1) ))".0-SNAPSHOT
git checkout -b releases/mars/"$VERSION_THIS"
git push --set-upstream origin releases/mars/"$VERSION_THIS"
set_version "$VERSION_THIS"
make
git commit -a -m 'Create release version '"$VERSION_THIS"
git tag -a -f -m 'Release '"$VERSION_THIS" v"$VERSION_THIS"
make docker-push
set_version "$VERSION_NEXT"
git commit -a -m 'Set version to '"$VERSION_NEXT"
set +o xtrace
echo "Remember, you must still push tags, push branch, create pull request, and change branches ..."
echo "+OK (release.sh)"