forked from EBISPOT/goci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-version.sh
executable file
·53 lines (46 loc) · 1.54 KB
/
update-version.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
#!/usr/bin/env bash
usage() {
echo "Usage: update-version.sh -v [VERSION NUMBER]"
echo "Required options:"
echo " -v The version to increment the next release to"
}
while getopts "v:h" opt; do
case $opt in
v)
echo "Updating GOCI project version number to $OPTARG"
VERSION=$OPTARG
;;
h)
usage
exit 0
;;
\?)
usage
exit 1
;;
:)
echo "Missing option argument for -$OPTARG"
exit 1
;;
*)
echo "Unimplemented option: -$OPTARG"
exit 1
;;
esac
done
if [ -z "$VERSION" ] ;
then
echo "No version number supplied - please give a non-empty version number to increment to"
exit 1
fi
base=${0%/*}/;
# invoke maven versions plugin to increment project structure versions
mvn -f $base/pom.xml versions:set -DnewVersion=$VERSION || exit 1
# switch into goci-dependencies and increment all project module versions
mvn -f $base/goci-dependencies/pom.xml versions:set -DnewVersion=$VERSION || exit 1
# finally replace version number property in goci-dependencies pom with new version
#The option -i created a problem. Mac vs unix. Below an alternative version
#sed -i "s/\(<goci.version>\)\([^<]*\)\(<\/goci.version>\)/\1$VERSION\3/g" $base/goci-dependencies/pom.xml || exit 1
echo "Change goci-dependencies/pom.xml"
cp $base/goci-dependencies/pom.xml $base/goci-dependencies/pom.xml.versionsBackup
sed "s/\(<goci.version>\)\([^<]*\)\(<\/goci.version>\)/\1$VERSION\3/g" $base/goci-dependencies/pom.xml.versionsBackup > $base/goci-dependencies/pom.xml || exit 1