forked from variacode/rundeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetversion.sh
executable file
·46 lines (34 loc) · 1.34 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
#!/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
VNUM=$1
shift
if [ -z "$1" ]; then
RELEASE=$CUR_RELEASE
else
RELEASE=$1
fi
shift
VTAG="${1}"
VDATE=`date +%Y%m%d`
VNAME=${VNUM}-${VTAG}-${VDATE}
echo "new NUMBER: ${VNUM}"
echo "new RELEASE: ${RELEASE}"
echo "new DATE: ${VDATE}"
echo "new VERSION: ${VNAME}"
#alter version.properties
perl -i'.orig' -p -e "s#^version\.number\s*=.*\$#version.number=$VNUM#" `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=$VTAG#" `pwd`/version.properties
perl -i'.orig' -p -e "s#^version\.date\s*=.*\$#version.date=$VDATE#" `pwd`/version.properties
perl -i'.orig' -p -e "s#^version\.version\s*=.*\$#version.version=$VNAME#" `pwd`/version.properties
perl -i'.orig' -p -e "s#^currentVersion\s*=.*\$#currentVersion = $VNUM#" `pwd`/gradle.properties
echo MODIFIED: `pwd`/version.properties