forked from rundeck/rundeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setversion.sh
executable file
·52 lines (41 loc) · 1.48 KB
/
setversion.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
CUR_VERSION=$(grep version.number= `pwd`/version.properties | cut -d= -f 2)
CUR_RELEASE=$(grep version.release.number= `pwd`/version.properties | cut -d= -f 2)
CUR_TAG=$(grep version.tag= `pwd`/version.properties | cut -d= -f 2)
echo "current NUMBER: $CUR_VERSION"
echo "current RELEASE: $CUR_RELEASE"
echo "current TAG: $CUR_TAG"
if [ -z "$1" ] ; then
echo "usage: setversion.sh <version> [release] [GA]"
exit 2
fi
VERSION=$1
shift
if [ -z "$1" ]; then
RELEASE=$CUR_RELEASE
else
RELEASE=$1
fi
shift
if [ "$1" = "GA" ]; then
TAG=
PTAG="GA"
elif [ -n "$1" ]; then
TAG="-$1"
PTAG="$1"
else
TAG="-SNAPSHOT"
PTAG="SNAPSHOT"
fi
VNAME="${VERSION}"
echo "new NUMBER: $VERSION${TAG}"
echo "new RELEASE: $RELEASE"
echo "new VERSION: ${VNAME}"
#alter version.properties
perl -i'.orig' -p -e "s#^version\.number\s*=.*\$#version.number=$VERSION#" `pwd`/version.properties
perl -i'.orig' -p -e "s#^version\.release\.number\s*=.*\$#version.release.number=$RELEASE#" `pwd`/version.properties
perl -i'.orig' -p -e "s#^version\.tag\s*=.*\$#version.tag=$PTAG#" `pwd`/version.properties
perl -i'.orig' -p -e "s#^currentVersion\s*=.*\$#currentVersion = $VERSION#" `pwd`/gradle.properties
echo MODIFIED: `pwd`/version.properties
perl -i'.orig' -p -e "s#^app.version\s*=.*\$#app.version = $VERSION${TAG}#" `pwd`/rundeckapp/application.properties
perl -i'.orig' -p -e "s#^build.ident\s*=.*\$#build.ident = $VERSION-${RELEASE}${TAG}#" `pwd`/rundeckapp/application.properties