forked from geonetwork/core-geonetwork
-
Notifications
You must be signed in to change notification settings - Fork 1
/
release-restore.sh
executable file
·42 lines (32 loc) · 1.21 KB
/
release-restore.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
#!/bin/bash
buildRequiredApps=( "java" "git" "mvn" "ant" "xmlstarlet" )
for app in "${buildRequiredApps[@]}"; do :
if ! [ -x "$(command -v ${app})" ]; then
echo "Error: ${app} is not installed." >&2
exit 1
fi
done
projectVersion=`xmlstarlet sel -t -m "/_:project/_:version" -v . -n pom.xml`
subVersion=`cut -d "-" -f 2 <<< $projectVersion`
mainVersion=`cut -d "-" -f 1 <<< $projectVersion`
mainVersionMajor=`cut -d "." -f 1 <<< $mainVersion`
mainVersionMinor=`cut -d "." -f 2 <<< $mainVersion`
mainVersionSub=`cut -d "." -f 3 <<< $mainVersion`
gitBranch=`git branch --show-current`
nextVersionNumber="${mainVersionMajor}.${mainVersionMinor}.$((mainVersionSub+1))"
previousVersionNumber="${mainVersionMajor}.${mainVersionMinor}.$((mainVersionSub-1))"
from=origin
frombranch=origin/${gitBranch}
series=${mainVersionMajor}.${mainVersionMinor}
versionbranch=${gitBranch}
version=${projectVersion}
minorversion=0
release=latest
newversion=${mainVersion}-$minorversion
currentversion=${projectVersion}
previousversion=${previousVersionNumber}
nextversion=${nextVersionNumber}-SNAPSHOT
# Set version number to SNAPSHOT
./update-version.sh $newversion $nextversion
git add .
git commit -m "Update version to $nextversion"