release.sh 4.2 KB
Newer Older
1
#!/bin/bash -ex
K
kohsuke 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# The MIT License
# 
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.


25 26 27
#
# Kohsuke's automated release script. Sorry for my checking this in,
# but Maven doesn't let me run release goals unless I have this in CVS.
28
umask 022 # we'll transfer files created during builds to Apache, where go=rx for directories are expected
K
kohsuke 已提交
29 30 31 32 33
xmlstarlet --version > /dev/null
if [ $? != 0 ]; then
  echo xmlstarlet is not installed
  exit -1
fi
K
kohsuke 已提交
34

K
kohsuke 已提交
35
# make sure we have up to date workspace
36
svn update
K
bug fix  
kohsuke 已提交
37 38
# if left-over hudson.war for Debian build from the last time, delete it.
rm hudson.war || true
K
kohsuke 已提交
39

K
kohsuke 已提交
40
tag=hudson-$(show-pom-version pom.xml | sed -e "s/-SNAPSHOT//g" -e "s/\\./_/g")
41
export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
K
kohsuke 已提交
42
mvn -B -Dtag=$tag -DskipTests release:prepare || mvn -B -Dtag=$tag -DskipTests install release:prepare || true
K
kohsuke 已提交
43 44
#svn up -r head
#mvn -B -Dtag=$tag -Dresume release:prepare
K
kohsuke 已提交
45
mvn release:perform
K
kohsuke 已提交
46

47
id=$(show-pom-version target/checkout/pom.xml)
K
kohsuke 已提交
48 49 50 51 52 53
case $id in
*-SNAPSHOT)
	echo Trying to release a SNAPSHOT
	exit 1
	;;
esac
54 55
javanettasks uploadFile hudson /releases/$id                "`date +"%Y/%m/%d"` release" Stable target/checkout/war/target/hudson.war | tee target/war-upload.log
warUrl=$(cat target/war-upload.log | grep "^Posted" | sed -e "s/Posted //g")
K
kohsuke 已提交
56
javanettasks uploadFile hudson /releases/source-bundles/$id "`date +"%Y/%m/%d"` release" Stable target/checkout/target/hudson-$id-src.zip
57
javanettasks announce hudson "Hudson $id released" "$warUrl" << EOF
58
See <a href="https://hudson.dev.java.net/changelog.html">the changelog</a> for details.
K
kohsuke 已提交
59
Download is available from <a href="$warUrl">here</a>.
60
EOF
K
kohsuke 已提交
61 62 63

# this is for the JNLP start
cp target/checkout/war/target/hudson.war target/checkout/war/target/hudson.jar
K
kohsuke 已提交
64 65 66 67
javanettasks uploadFile hudson /releases/jnlp/hudson.jar "version $id" Stable target/checkout/war/target/hudson.jar | tee target/upload.log

# replace the jar file link accordingly
WWW=../../../www
68
pushd $WWW
K
kohsuke 已提交
69
svn revert -R .
70
svn update
71
popd
K
kohsuke 已提交
72
jarUrl=$(cat target/upload.log | grep "^Posted" | sed -e "s/Posted //g")
73
perl -p -i.bak -e "s|https://.+hudson\.jar|$jarUrl|" $WWW/hudson.jnlp
K
kohsuke 已提交
74
cp $WWW/hudson.jnlp $WWW/$id.jnlp
K
kohsuke 已提交
75 76

# update changelog.html
K
kohsuke 已提交
77 78
ruby update.changelog.rb $id < $WWW/changelog.html > $WWW/changelog.new
mv $WWW/changelog.new $WWW/changelog.html
K
kohsuke 已提交
79 80

# push changes to the maven repository
K
kohsuke 已提交
81
ruby push-m2-repo.rb $id
K
kohsuke 已提交
82

83
chmod u+x publish-javadoc.sh
K
kohsuke 已提交
84 85
./publish-javadoc.sh

86
# update index
87 88 89
pushd target/checkout
./javadocReverseIndex.groovy > ../../.htaccess
popd
90 91
scp .htaccess hudson-ci.org:~/www/hudson-ci.org/javadoc/byShortName

92
# create and publish debian package
93
chmod u+x release-debian.sh
94
./release-debian.sh $id
95
svn commit -m "updated changelog as a part of the release" debian/changelog
96

K
kohsuke 已提交
97
# publish IPS. The server needs to be restarted for it to see the new package.
98
cat war/target/hudson-war-$id.ipstgz | ssh wsinterop.sun.com "cd ips/repository; gtar xvzf -"
K
kohsuke 已提交
99
ssh wsinterop.sun.com "cd ips; ./start.sh"
100

K
kohsuke 已提交
101
pushd $WWW
K
kohsuke 已提交
102
svn commit -m "Hudson $id released" changelog.html hudson.jnlp
K
kohsuke 已提交
103 104 105 106 107 108 109
popd

# sorcerer
pushd target/checkout
mvn -P sorcerer sorcerer:aggregate
rsync -avz target/site/sorcerer wsinterop.sun.com:~/public_html_hudson/
popd
110 111 112 113 114 115

# RPM
pushd rpm
./build.sh ../hudson.war
./rsync.sh
popd