forked from duniter-gchange/gchange-pod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·56 lines (47 loc) · 1.42 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
#!/bin/bash
mkdir .local
RELEASE_OPTS="-DskipTests -DperformFullRelease"
# 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 "**********************************"
result=`mvn release:clean`
failure=`echo "$result" | grep -m1 -P "\[INFO\] BUILD FAILURE" | grep -oP "BUILD \w+"`
# prepare failed
if [[ ! "_$failure" = "_" ]]; then
echo "$result" | grep -P "\[ERROR\] "
exit 1
fi
mvn release:prepare -Darguments="${RELEASE_OPTS}"
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "**********************************"
echo "* Performing release..."
echo "**********************************"
mvn release:perform --quiet -Darguments="${RELEASE_OPTS}"
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "**********************************"
echo "* Uploading artifacts to Github..."
echo "**********************************"
cd target/checkout
./github.sh pre
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "RELEASE finished !"