-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·52 lines (40 loc) · 1.3 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
#!/bin/bash
# Stop on errors
set -e
display_usage() {
echo -e "Usage: release.sh <RELEASE_VERSION> <NEXT_DEV_VERSION>"
}
if [ $# -ne 2 ]
then
display_usage
exit 1
fi
sedi(){
case "`uname`" in
Darwin*) sed -i '' "$1" "$2" ;;
*) sed -i "$1" "$2" ;;
esac
}
RELVERSION=$1
DEVVERSION=$2
pendingChangesInIndex=`git status -s --untracked-files=no | grep "^[^?]" | wc -l | tr -d '[[:space:]]'`
if [ "$pendingChangesInIndex" != "0" ]
then
# Stashing current changes
git stash
fi
sedi "s/\"restx.shell.version\"[[:space:]]*:[[:space:]]*\"[0-9\\.a-zA-Z\\-]*\",/\"restx.shell.version\": \"$RELVERSION\",/g" restx.build.properties.json
restx build generate ivy
git add . && git commit -m "preparing $RELVERSION"
mvn "-DreleaseVersion=$RELVERSION" "-DdevelopmentVersion=$DEVVERSION" -B release:prepare release:perform
sedi "s/\"restx.shell.version\"[[:space:]]*:[[:space:]]*\"[0-9\\.a-zA-Z\\-]*\",/\"restx.shell.version\": \"$DEVVERSION\",/g" restx.build.properties.json
sedi "s/<restx.shell.version>[0-9\\.a-zA-Z\\-]*</<restx.shell.version>$DEVVERSION</g" pom.xml
restx build generate ivy
git add . && git commit -m "re-snapshoted restx.version property"
if [ "$pendingChangesInIndex" != "0" ]
then
# Stash pop should be made in the end only
git stash pop
fi
echo ""
echo " RESTX SHELL Release successful !"