forked from geonetwork/core-geonetwork
-
Notifications
You must be signed in to change notification settings - Fork 1
/
release-build.sh
executable file
·85 lines (68 loc) · 2.81 KB
/
release-build.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
75
76
77
78
79
80
81
82
83
84
85
#!/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
function showUsage
{
echo -e "\nThis script is used to build a release for the current branch"
echo
}
if [ "$1" = "-h" ]
then
showUsage
exit
fi
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
echo "Building release for version ${newversion} (from ${currentversion})."
echo ""
echo "Before you start:"
echo "1. Use web-ui/download-from-transifex.sh to update translations"
echo "2. Use release-notes.sh to update change log and release notes"
echo ""
echo "After being build you can test the release before publishing. Git branch ${gitBranch}."
read -p "Press enter to continue"
# Update version number (in pom.xml, installer config and SQL)
./update-version.sh $currentversion $newversion
# Then commit the new version
git add .
git commit -m "Update version to $newversion"
git tag -a $mainVersion -m "Tag for $newversion release"
# Build the new release
mvn clean install -DskipTests -ntp -Pwar -Pwro4j-prebuild-cache
(cd datastorages && mvn clean install -DskipTests -ntp -Drelease -DskipTests)
# Download Jetty and create the installer
(cd release && mvn clean install -Pjetty-download && ant)
# generate checksum for download artifacts
if [ -f "release/target/GeoNetwork-$version/geonetwork-bundle-$newversion.zip.MD5" ]; then
rm release/target/GeoNetwork-$version/geonetwork-bundle-$newversion.zip.MD5
fi
if [[ ${OSTYPE:0:6} == 'darwin' ]]; then
md5 -r web/target/geonetwork.war > web/target/geonetwork.war.md5
md5 -r release/target/GeoNetwork-$nextVersionNumber/geonetwork-bundle-$newversion.zip > release/target/GeoNetwork-$nextVersionNumber/geonetwork-bundle-$newversion.zip.md5
else
(cd web/target && md5sum geonetwork.war > geonetwork.war.md5)
(cd release/target/GeoNetwork-$nextVersionNumber && md5sum geonetwork-bundle-$newversion.zip > geonetwork-bundle-$newversion.zip.md5)
fi