-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·126 lines (99 loc) · 2.86 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
# Script to build, deploy and release Elemento. Make sure the different branches
# have the same feature set, before calling this script.
#
# Prerequisites
# - Clean git status (no uncommitted changes in branch 'develop' and 'gwt2')
# - No tag for the specified version
#
# Parameters
# 1. New version number
#
# What it does
# 1. Build & deploy branch 'develop' and 'gwt2'
# 2. Bump versions to '<version>' and '<version>-gwt2'
# 3. Switch back to 'HEAD-SNAPSHOT' 'GWT2-SNAPSHOT'
ROOT=$PWD
VERSION=$1
function box()
{
local s="$*"
tput setaf 3
echo
echo
echo
echo " -${s//?/-}-
| ${s//?/ } |
| $(tput setaf 4)$s$(tput setaf 3) |
| ${s//?/ } |
-${s//?/-}-"
tput sgr 0
}
# Prerequisites
if [[ "$#" -ne 1 ]]; then
echo "Illegal number of parameters. Please use $0 <version>"
exit -1
fi
if git rev-parse -q --verify "refs/tags/$VERSION" >/dev/null; then
echo "A tag for '$VERSION' already exists."
exit -1
fi
if git rev-parse -q --verify "refs/tags/$VERSION-gwt2" >/dev/null; then
echo "A tag for '$VERSION-gwt2' already exists."
exit -1
fi
git checkout develop
if ! git diff --no-ext-diff --quiet --exit-code; then
echo "Unable to release. You have uncommitted changes in the branch 'develop'."
exit -1
fi
git checkout gwt2
if ! git diff --no-ext-diff --quiet --exit-code; then
echo "Unable to release. You have uncommitted changes in the branch 'gwt2'."
exit -1
fi
# Branch 'gwt2'
BRANCH=gwt2
box "Switch to branch '$BRANCH'"
git checkout $BRANCH
git pull origin $BRANCH
box "Build branch '$BRANCH'"
mvn clean install -P widget || { echo "Maven build failed" ; exit 1; }
box "Update version to '$VERSION-gwt2'"
./versionBump.sh $VERSION-gwt2
git commit -am "Bump to $VERSION-gwt"
box "Deploy '$VERSION-gwt2'"
mvn deploy -P release,widget || { echo "Maven deploy failed" ; exit 1; }
git tag $VERSION-gwt
git push origin $BRANCH
git push origin --tags
box "Back to 'GWT2-SNAPSHOT'"
./versionBump.sh GWT2-SNAPSHOT
git commit -am "Back to GWT2-SNAPSHOT"
git push origin $BRANCH
# Branch 'develop'
BRANCH=develop
box "Switch to branch '$BRANCH'"
git checkout $BRANCH
git pull origin $BRANCH
box "Build branch '$BRANCH'"
mvn clean install -P samples,testsuite,widget || { echo "Maven build failed" ; exit 1; }
box "Update version to '$VERSION'"
git flow release start $VERSION
./versionBump.sh $VERSION
git commit -am "Bump to $VERSION"
box "Deploy '$VERSION'"
mvn deploy -P release,samples,testsuite,widget || { echo "Maven deploy failed" ; exit 1; }
export GIT_MERGE_AUTOEDIT=no
git flow release finish -m "$VERSION" $VERSION
unset GIT_MERGE_AUTOEDIT
git push origin develop
git push origin master
git push origin --tags
box "Back to 'HEAD-SNAPSHOT'"
git checkout $BRANCH
./versionBump.sh HEAD-SNAPSHOT
git commit -am "Back to HEAD-SNAPSHOT"
git push origin $BRANCH
# Done
box " <<--== Elemento successfully released ==-->> "