forked from liquidkarma/stdf4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease
executable file
·69 lines (59 loc) · 1.72 KB
/
release
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
#!/bin/sh
# mvn release:prepare
# mvn release:perform
# would work better, but for some reason the svn commits fail
# for me through googlecode
BASE="https://stdf4j.googlecode.com/svn"
TRUNK="$BASE/trunk"
TAGS="$BASE/tags"
OUT=`svn st`
if [ ! -z "$OUT" ]
then
echo Unresolved commits exist... exiting
exit 1
else
VERSION=`grep '<version>' pom.xml | sed -e 's/<\/*version>//g' | sed -e 's/ *//g'`
RELEASE_VERSION=`echo $VERSION | sed -e 's/-SNAPSHOT//'`
/bin/echo -n "Current version is $VERSION, release version [$RELEASE_VERSION]: "
read input
if [ ! -z "$input" ]
then
RELEASE_VERSION=$input
fi
DEV_REVISION=`echo $RELEASE_VERSION | awk -F. '{print $NF}' | xargs expr 1 +`
DEV_VERSION=`echo $RELEASE_VERSION | sed -e "s/\(.*\.\).*/\1$DEV_REVISION-SNAPSHOT/"`
/bin/echo -n "Next development version [$DEV_VERSION]: "
read input
if [ ! -z "$input" ]
then
DEV_VERSION=$input
fi
echo "Releasing version $RELEASE_VERSION"
echo "With next development version $DEV_VERSION"
for file in `find . -name 'pom.xml'`
do
sed -i -e "s/$VERSION/$RELEASE_VERSION/g" $file
done
svn ci -m "[release]: releasing version $RELEASE_VERSION"
if [ $? -ne 0 ]
then
echo "Error checking in release"
exit 1
fi
svn cp $TRUNK $TAGS/$RELEASE_VERSION -m "[release]: creating tag for $RELEASE_VERSION"
if [ $? -ne 0 ]
then
echo "Error creating tag"
exit 1
fi
for file in `find . -name 'pom.xml'`
do
sed -i -e "s/$RELEASE_VERSION/$DEV_VERSION/g" $file
done
svn ci -m "[release]: updating to next development version $DEV_VERSION"
if [ $? -ne 0 ]
then
echo "Error updating to next development version"
exit 1
fi
fi