git-tag-release: Push just the new tag; fetch before retry
[xapian.git] / xapian-maintainer-tools / git-tag-release
blobb31fcefb10a45f658bca9539e218633b0598aefc
1 #!/bin/sh
3 # Copyright (C) 2004,2005,2007,2008,2010,2012,2013,2014,2015 Olly Betts
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to
7 # deal in the Software without restriction, including without limitation the
8 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 # sell copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 # IN THE SOFTWARE.
23 set -e
25 BRANCH=master
27 version=$1
29 # check parameter was passed and that it looks like a version
30 case $version in
31 [0-9].[0-9].[0-9]) ;;
32 [0-9].[0-9].[1-9][0-9]) ;;
34 echo "Syntax: $0 VERSION"
35 echo "e.g. $0 1.0.18"
36 exit 1
38 esac
40 # Check that we've not already done this version.
41 download_dir=/srv/www/oligarchy.co.uk/xapian/$version
42 if [ -d "$download_dir" ] ; then
43 echo "Version $version already has a download directory:"
44 echo " $download_dir"
45 exit 1
48 if [ "`git branch --color=never --contains|cut -d' ' -f2-`" != "$BRANCH" ] ; then
49 echo "Not on branch $BRANCH"
50 exit 1
53 # Avoid tagging a release with the wrong versions in the tarballs (as
54 # happened with 1.1.4).
55 bad=0
56 escaped_version=`echo "$version"|sed 's/\([^0-9]\)/\\\\\\1/g'`
57 for d in xapian-core xapian-bindings xapian-applications/omega ; do
58 grep '^\(AC_INIT(\|m4_define(\[project_version\],\).*\<'"$escaped_version"'\>' "$d/configure.ac" >/dev/null || {
59 echo "$d/configure.ac not version $version" 1>&2
60 bad=1
62 done
63 [ "$bad" = "0" ] || exit 1
65 tag=v$version
66 while ! git tag -v "$tag" > /dev/null 2>&1 ; do
67 cat <<EOF
68 No '$tag' tag found - please create a signed tag and push it - in your local
69 tree do this:
71 git fetch && git tag -s -m 'Xapian $version release' '$tag' '$BRANCH' && git push origin '$tag'
73 Once you've done that, hit ENTER in this terminal to continue.
74 EOF
75 read dummy
76 git fetch
77 done
79 echo "Building release tarballs"
80 # Create a directory so the snapshotter will build this.
81 D=/home/olly/tmp/xapian-git-snapshot/tags
82 test -d "$D" || mkdir "$D"
83 mkdir "$D/$tag"
85 # Snapshotter will automatically copy the tarballs onto the website.
86 echo "Running:"
87 set -x
88 $HOME/bin/make-xapian-git-snapshot-tarballs "tags/$tag"
89 set +x
91 # Clean up.
92 rm -rf "$D/$tag"
93 rmdir $D || echo "Directory '$D' not removed."
95 # Add the version to the list in trac, close old milestone, ensure new
96 # milestone exists, and create the ReleaseNotes and ReleaseOverview
97 # pages:
98 xapian-trac-new-release "$version"