-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·46 lines (38 loc) · 1.21 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
#!/bin/bash
RELEASE_OPTS="-DskipTests"
#RELEASE_OPTS=""
# Rollback previous release, if need
if [[ -f "pom.xml.releaseBackup" ]]; then
echo "**********************************"
echo "* Rollback previous release..."
echo "**********************************"
result=`mvn release:rollback`
failure=`echo "$result" | grep -m1 -P "\[INFO\] BUILD FAILURE" | grep -oP "BUILD \w+"`
# rollback failed
if [[ ! "_$failure" = "_" ]]; then
echo "$result" | grep -P "\[ERROR\] "
exit 1
fi
echo "Rollback previous release [OK]"
fi
echo "**********************************"
echo "* Preparing release..."
echo "**********************************"
mvn release:prepare --quiet -Darguments="${RELEASE_OPTS}"
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "Prepare release [OK]"
echo "**********************************"
echo "* Performing release..."
echo "**********************************"
mvn release:perform --quiet -Darguments="${RELEASE_OPTS}"
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "Perform release [OK]"
echo "**********************************"
echo "* Compiling sources..."
echo "**********************************"
mvn clean install -DskipTests --quiet
echo "Compiling sources [OK]"