forked from rundeck/rundeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setversion.sh
executable file
·39 lines (29 loc) · 1.1 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
#!/bin/bash
CUR_VERSION="$(grep version.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 TAG: $CUR_TAG"
if [ -z "$1" ] ; then
echo "usage: setversion.sh <version> [GA|rcX]"
exit 2
fi
VNUM="$1"
shift
VTAG="${1:-GA}"
VDATE="$(date +%Y%m%d)"
if [ "$VTAG" == "GA" ] ; then
VNAME="$VNUM-$VDATE"
else
VNAME="$VNUM-$VTAG-$VDATE"
fi
echo "new NUMBER: $VNUM"
echo "new DATE: $VDATE"
echo "new TAG: $VTAG"
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\\.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