forked from maczech/helix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bump-up.command
executable file
·84 lines (72 loc) · 2.68 KB
/
bump-up.command
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
#/bin/bash
# colorful echo
red='\e[00;31m'
green='\e[00;32m'
function cecho
{
message="$1"
if [ -n "$message" ]; then
color="$2"
if [ -z "$color" ]; then
echo "$message"
else
echo -e "$color$message\e[00m"
fi
fi
}
echo There are $# arguments to $0: $*
if [ "$#" -eq 2 ]; then
version=$1
new_version=$2
else
version=`grep -A 1 "<artifactId>helix</artifactId>" pom.xml | grep "<version>" | awk 'BEGIN {FS="[<,>]"};{print $3}'`
minor_version=`echo $version | cut -d'.' -f3`
major_version=`echo $version | cut -d'.' -f1` # should be 0
submajor_version=`echo $version | cut -d'.' -f2`
new_minor_version=`expr $minor_version + 1`
# new_version=`echo $version | sed -e "s/${minor_version}/${new_minor_version}/g"`
new_version="$major_version.$submajor_version.$new_minor_version"
fi
cecho "bump up: $version -> $new_version" $red
#: <<'END'
cecho "bump up pom.xml" $green
sed -i "s/${version}/${new_version}/g" pom.xml
# git diff pom.xml
grep -C 1 "$new_version" pom.xml
cecho "bump up helix-core/pom.xml" $green
sed -i "s/${version}/${new_version}/g" helix-core/pom.xml
grep -C 1 "$new_version" helix-core/pom.xml
# git diff helix-core/pom.xml
ivy_file="helix-core-"$version".ivy"
new_ivy_file="helix-core-"$new_version".ivy"
# echo "$ivy_file"
if [ -f helix-core/$ivy_file ]; then
cecho "bump up helix-core/$ivy_file" $green
git mv "helix-core/$ivy_file" "helix-core/$new_ivy_file"
sed -i "s/${version}/${new_version}/g" "helix-core/$new_ivy_file"
grep -C 1 "$new_version" "helix-core/$new_ivy_file"
else
cecho "helix-core/$ivy_file not exist" $red
fi
cecho "bump up helix-admin-webapp/pom.xml" $green
sed -i "s/${version}/${new_version}/g" helix-admin-webapp/pom.xml
grep -C 1 "$new_version" helix-admin-webapp/pom.xml
# git diff helix-core/pom.xml
ivy_file="helix-admin-webapp-"$version".ivy"
new_ivy_file="helix-admin-webapp-"$new_version".ivy"
# echo "$ivy_file"
if [ -f helix-admin-webapp/$ivy_file ]; then
cecho "bump up helix-admin-webapp/$ivy_file" $green
git mv "helix-admin-webapp/$ivy_file" "helix-admin-webapp/$new_ivy_file"
sed -i "s/${version}/${new_version}/g" "helix-admin-webapp/$new_ivy_file"
grep -C 1 "$new_version" "helix-admin-webapp/$new_ivy_file"
else
cecho "helix-admin-webapp/$ivy_file not exist" $red
fi
cecho "bump up mockservice/pom.xml" $green
sed -i "s/${version}/${new_version}/g" mockservice/pom.xml
grep -C 1 "$new_version" mockservice/pom.xml
cecho "bump up helix-core/src/main/resources/cluster-manager-version.properties" $green
sed -i "s/${version}/${new_version}/g" helix-core/src/main/resources/cluster-manager-version.properties
grep -C 1 "$new_version" helix-core/src/main/resources/cluster-manager-version.properties
#END