forked from j256/cloudwatch-logback-appender
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.sh
117 lines (93 loc) · 2.93 KB
/
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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/sh
#
# Release script for SimpleJmx
#
LIBRARY="cloudwatch-logback-appender"
LOCAL_DIR="$HOME/svn/local/$LIBRARY"
#############################################################
# check ChangeLog
head -1 src/main/javadoc/doc-files/changelog.txt | fgrep '?' > /dev/null 2>&1
if [ $? -ne 1 ]; then
echo "No question-marks (?) can be in the ChangeLog top line."
head -1 src/main/javadoc/doc-files/changelog.txt
exit 1
fi
#############################################################
# check for not commited files:
cd $LOCAL_DIR
git status | grep 'nothing to commit'
if [ $? -ne 0 ]; then
/bin/echo "Files not checked-in"
git status
exit 1
fi
#############################################################
# check maven settings
grep sonatype-nexus-snapshots $HOME/.m2/settings.xml > /dev/null 2>&1
if [ $? -ne 0 ]; then
/bin/echo "Can't find sonatype info in the maven settings.xml file"
exit 1
fi
#############################################################
release=`grep version pom.xml | grep SNAPSHOT | head -1 | cut -f2 -d\> | cut -f1 -d\-`
/bin/echo ""
/bin/echo ""
/bin/echo ""
/bin/echo "------------------------------------------------------- "
/bin/echo -n "Enter release number [$release]: "
read rel
if [ "$rel" != "" ]; then
release=$rel
fi
#############################################################
# check docs:
cd $LOCAL_DIR
ver=`head -1 src/main/javadoc/doc-files/changelog.txt | cut -f1 -d:`
if [ "$release" != "$ver" ]; then
echo "Change log top line version seems wrong:"
head -1 src/main/javadoc/doc-files/changelog.txt
exit 1
fi
ver=`grep "^@set ${LIBRARY}_version" src/main/doc/$LIBRARY.texi | cut -f3 -d' '`
if [ "$release" != "$ver" ]; then
/bin/echo "$LIBRARY.texi version seems wrong:"
grep "^@set ${LIBRARY}_version" src/main/doc/$LIBRARY.texi
/bin/echo -n "Press control-c to quit otherwise return. [ok] "
read cont
fi
#############################################################
# run tests
cd $LOCAL_DIR
mvn test || exit 1
#############################################################
/bin/echo ""
/bin/echo -n "Enter the GPG pass-phrase: "
read gpgpass
GPG_ARGS="-Darguments=-Dgpg.passphrase=$gpgpass -Dgpg.passphrase=$gpgpass -DgpgPhase=verify"
tmp="/tmp/release.sh.$$.t"
touch $tmp
gpg --passphrase $gpgpass -s -u D3412AC1 $tmp > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Passphrase incorrect"
exit 1
fi
rm -f $tmp*
#############################################################
/bin/echo ""
/bin/echo "------------------------------------------------------- "
/bin/echo "Releasing version '$release'"
sleep 3
#############################################################
# releasing to sonatype
/bin/echo ""
/bin/echo ""
/bin/echo -n "Should we release to sonatype [y]: "
read cont
if [ "$cont" = "" -o "$cont" = "y" ]; then
cd $LOCAL_DIR
mvn -P st release:clean || exit 1
mvn $GPG_ARGS -P st release:prepare || exit 1
mvn $GPG_ARGS -P st release:perform || exit 1
echo ""
echo ""
fi