forked from Kong/docker-kong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
executable file
·85 lines (68 loc) · 1.94 KB
/
update.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
set -e
if ! [ "$1" ]
then
echo "usage: $0 <version> [<prev_tag>]"
echo "example: $0 1.2.3 1.2.2"
exit 1
fi
version=$1
prev_tag=$2
if [ "$prev_tag" = "" ]
then
prev_tag=master
fi
function red() {
echo -e "\033[1;31m$@\033[0m"
}
function die() {
red "*** $@"
echo "See also: $0 --help"
echo
exit 1
}
hub --version &> /dev/null || die "hub is not in PATH. Get it from https://github.com/github/hub"
pushd alpine
./build-ce.sh
mv /tmp/kong.tar.gz /tmp/kong.tar.gz.old
old_sha=$(sha256sum /tmp/kong.tar.gz.old | cut -b1-64)
VERSION=$version ./build-ce.sh || true
mv /tmp/kong.tar.gz /tmp/kong.tar.gz.new
new_sha=$(sha256sum /tmp/kong.tar.gz.new | cut -b1-64)
sed -i -e 's/'$old_sha'/'$new_sha'/g' build-ce.sh
rm /tmp/kong.tar.gz.*
popd
pushd centos
./build-ce.sh
mv /tmp/kong.rpm /tmp/kong.rpm.old
old_sha=$(sha256sum /tmp/kong.rpm.old | cut -b1-64)
VERSION=$version ./build-ce.sh || true
mv /tmp/kong.rpm /tmp/kong.rpm.new
new_sha=$(sha256sum /tmp/kong.rpm.new | cut -b1-64)
sed -i -e 's/'$old_sha'/'$new_sha'/g' build-ce.sh
rm /tmp/kong.rpm.*
popd
pushd rhel
./build-ce.sh
mv /tmp/kong.rpm /tmp/kong.rpm.old
old_sha=$(sha256sum /tmp/kong.rpm.old | cut -b1-64)
VERSION=$version ./build-ce.sh || true
mv /tmp/kong.rpm /tmp/kong.rpm.new
new_sha=$(sha256sum /tmp/kong.rpm.new | cut -b1-64)
sed -i -e 's/'$old_sha'/'$new_sha'/g' build-ce.sh
rm /tmp/kong.rpm.*
popd
sed -i -e "s/$prev_tag/$version/" */build-ce.sh
echo "****************************************"
git diff
echo "****************************************"
echo "Everything looks all right? (y/n)"
echo "(Answering y will commit, push the branch, and open a browser with the PR)"
read
if ! [ "$REPLY" == "y" ]
then
exit 1
fi
git commit -av -m "chore(*) bump to Kong $version"
git push --set-upstream origin release/$version
hub pull-request -b master -h "$branch" -m "Release: $version"