forked from geoadmin/geocat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
resetReleaseVersions.sh
73 lines (60 loc) · 1.77 KB
/
resetReleaseVersions.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
#!/bin/bash
# Usage to reset a version number from e.g. 2.7.1 to 2.7.0
# In root folder of branch code: ./resetReleaseVersions.sh 2.7.1 2.7.0
version="$1"
new_version="$2"
function showUsage
{
echo -e "\nThis script is used to reset a version number from e.g. 2.7.1 to 2.7.0"
echo
echo -e "Usage: ./`basename $0 $1` actual_version next_version"
echo
echo -e "Example to update file versions from 2.7.0 to 2.7.1:"
echo -e "\t./`basename $0 $1` 2.7.0 2.7.1"
echo
}
if [ "$1" = "-h" ]
then
showUsage
exit
fi
if [ $# -ne 2 ]
then
showUsage
exit
fi
if [[ $1 != [0-9].[0-9].[0-9] ]]; then
echo
echo 'Update failed due to incorrect versionnumber format: ' $1
echo 'The format should be three numbers separated by dots. e.g.: 2.7.0'
echo
echo "Usage: ./`basename $0 $1` 2.7.1 2.7.0"
echo
exit
fi
if [[ $2 != [0-9].[0-9].[0-9] ]]; then
echo
echo 'Update failed due to incorrect new versionnumber format (' $2 ')'
echo 'The format should be three numbers separated by dots. e.g.: 2.7.1'
echo
echo "Usage: ./`basename $0 $1` 2.7.1 2.7.0"
echo
exit
fi
# Note: In MacOS (darwin10.0) sed requires -i .bak as option to work properly
if [[ $OSTYPE == 'darwin10.0' ]]; then
sedopt='-i .bak'
else
sedopt='-i'
fi
echo
echo 'Your Operating System is' $OSTYPE
echo 'sed will use the following option: ' $sedopt
echo
# Update version in sphinx doc files
sed $sedopt "s/${version}/${new_version}/g" docs/eng/users/source/conf.py
sed $sedopt "s/${version}/${new_version}/g" docs/eng/developer/source/conf.py
# Update installer
sed $sedopt "s/\<property name=\"version\" value=\"${version}\" \/\>/\<property name=\"version\" value=\"${new_version}\" \/\>/g" installer/build.xml
# Update version pom files
find . -name pom.xml -exec sed $sedopt "s/${version}/${new_version}/g" {} \;