-
Notifications
You must be signed in to change notification settings - Fork 21
/
prepare-release.sh
executable file
·48 lines (39 loc) · 2.18 KB
/
prepare-release.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
!#! /bin/bash
RELEASE_VERSION=$1
NEW_VERSION=$3
RELEASE_VERSION_QUALIFIER=$2
WORKSPACE=${WORKSPACE:-'.'}
if [ -z "$RELEASE_VERSION" ]; then
echo "ERROR: Release version argument not supplied"
exit 1
fi
if [ -z "$NEW_VERSION" ]; then
echo "ERROR: New version argument not supplied"
exit 1
fi
pushd $WORKSPACE &> /dev/null
# Update the versions in the build.xml file
sed -i 's@<property name="bv\.version\.spec" value=".*" />@<property name="bv.version.spec" value="'${RELEASE_VERSION%.*}'" />@' build.xml
if [ ! -z "$RELEASE_VERSION_QUALIFIER" ]; then
# there is an issue with this specific expression if passed directly to sed
sed_expression='s@<property name="bv\.version\.qualifier" value=".*" />@<property name="bv.version.qualifier" value="'${RELEASE_VERSION_QUALIFIER}'" />@'
sed -i "${sed_expression}" build.xml
fi
sed -i 's@<property name="bv\.revdate" value=".*" />@<property name="bv.revdate" value="'$(date +%Y-%m-%d)'" />@' build.xml
sed -i 's@<property name="license" value=".*" />@<property name="license" value="license-final" />@' build.xml
sed -i 's@<property name="logo" value=".*" />@<property name="logo" value="jakarta_ee_logo_schooner_color_stacked_default.png[pdfwidth=4.25in,align=right]" />@' build.xml
git add build.xml
git commit -m "[Jenkins release job] Preparing release $RELEASE_VERSION"
git tag $RELEASE_VERSION
# Go back to a snapshot version
sed -i 's@<property name="bv\.version\.spec" value=".*" />@<property name="bv.version.spec" value="'${NEW_VERSION%.*}'" />@' build.xml
sed -i 's@<property name="bv\.version\.qualifier" value=".*" />@<property name="bv.version.qualifier" value="" />@' build.xml
sed -i 's@<property name="bv\.revdate" value=".*" />@<property name="bv.revdate" value="${current.date}" />@' build.xml
sed -i 's@<property name="license" value=".*" />@<property name="license" value="license-evaluation" />@' build.xml
sed -i 's@<property name="logo" value=".*" />@<property name="logo" value="beanvalidation_logo.png[align=left,pdfwidth=20%]" />@' build.xml
# Prepare next development iteration
git add build.xml
git commit -m "[Jenkins release job] Preparing next development iteration"
git push origin master
git push origin $RELEASE_VERSION
popd &> /dev/null