-
Notifications
You must be signed in to change notification settings - Fork 8
/
release-utils.sh
executable file
·75 lines (58 loc) · 1.34 KB
/
release-utils.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
REQUIRED_BASH_VERSION=3.0.0
if [[ $BASH_VERSION < $REQUIRED_BASH_VERSION ]]; then
echo "You must use Bash version 3 or newer to run this script"
exit
fi
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
# DEFINE
VERSION_REGEX='([0-9]*)\.([0-9]*)([a-zA-Z0-9\.]*)'
# SCRIPT
usage()
{
cat << EOF
usage: $0 options
This script aids in releasing the windup site
OPTIONS:
-u Updates version numbers in all POMs, used with -o and -n
-o Old version number to update from
-n New version number to update to
-h Shows this message
EOF
}
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
update()
{
cd $DIR/
echo "Updating versions from $OLDVERSION TO $NEWVERSION for all Java and XML files under $PWD"
perl -pi -e "s/version: ${OLDVERSION}/version: ${NEWVERSION}/g" _config/site.yml
}
OLDVERSION="1.0.0-SNAPSHOT"
NEWVERSION="1.0.0-SNAPSHOT"
VERSION="1.0.0-SNAPSHOT"
CMD="usage"
while getopts “uo:n:” OPTION
do
case $OPTION in
u)
CMD="update"
;;
h)
usage
exit
;;
o)
OLDVERSION=$OPTARG
;;
n)
NEWVERSION=$OPTARG
;;
[?])
usage
exit
;;
esac
done
$CMD