[ci] Use pre-set ANDROID_NDK variable
[xapian.git] / xapian-maintainer-tools / git-tag-release
blob86be6333f2487de27e3ef9cd87ea386559e3388b
1 #!/bin/sh
3 # Copyright (C) 2004-2024 Olly Betts
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 RELEASE_WEB_BASE_URL=https://oligarchy.co.uk/xapian
28 RELEASE_WEB_BASE_DIR=/srv/www/oligarchy.co.uk/xapian
30 version=$1
32 # check parameter was passed and that it looks like a version
33 case $version in
34 [0-9].[0-9].[0-9]) ;;
35 [0-9].[0-9].[1-9][0-9]) ;;
37 echo "Syntax: $0 VERSION"
38 echo "e.g. $0 1.0.18"
39 exit 1
41 esac
43 # Check that we've not already done this version.
44 RELEASE_URL=$RELEASE_WEB_BASE_URL/$version/
45 # Needs to NOT have a trailing `/` or else scp fails.
46 RELEASE_DIR=$RELEASE_WEB_BASE_DIR/$version
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 head_output=`HEAD "$RELEASE_URL" 2>/dev/null||true`
66 case $head_output in
67 "404 "*) ;;
69 cat <<END
70 Version $version already has a download directory:
71 $ HEAD '$RELEASE_URL'
72 $head_output
73 END
74 exit 1
76 esac
78 echo "Setting up temporary source tree"
79 DIR=`mktemp -d TMP.make_dist.XXXXXXXXXX`
80 git clone . "$DIR"
81 mkdir "$DIR/BUILD"
82 # Ignore failure - there may be no cached tarballs.
83 ln BUILD/*.tar* "$DIR/BUILD" || true
84 cd "$DIR"
85 git clone ../swig
87 echo "Building release tarballs"
88 ./bootstrap --download-tools=always
89 ./configure
90 time make -sj8
91 time make -sj8 distcheck XAPIAN_CONFIG=`pwd`/xapian-core/xapian-config LD_LIBRARY_PATH=`pwd`/xapian-core/.libs
92 cd ..
94 RESULT=`mktemp -d "RESULT-$version-XXXXXXXXXX"`
95 echo "Signing tarballs"
96 find "$DIR" -name "xapian-*-$version.tar.*"|while read f ; do
97 # Retry signing until successful.
98 while ! gpg --detach-sign --armour "$f" ; do sleep 60 ; done
99 mv "$f" "$f.asc" "$RESULT"
100 done
102 echo "Deleting build tree"
103 rm -rf "$DIR"
105 echo "Tagging"
106 tag=v$version
107 if git tag -v "$tag" > /dev/null 2>&1 ; then
108 echo "Tag '$tag' exists"
109 else
110 echo "Tagging '$tag'"
111 git tag -s -m "Xapian $version release" "$tag" "$BRANCH"
114 echo "Copying to server"
115 chmod 755 "$RESULT"
116 scp -r "$RESULT" thyestes.tartarus.org:"$RELEASE_DIR"
118 echo "Adding to trac"
119 # Add the version to the list in trac, close old milestone, ensure new
120 # milestone exists, and create the ReleaseNotes and ReleaseOverview
121 # pages:
122 ssh thyestes.tartarus.org bin/xapian-trac-new-release "$version"
124 checksums=`cd "$RESULT" && sha256sum *.tar.*|grep -v '\.asc$'`
125 echo "Checksums:"
126 echo "$checksums"
128 cat <<END > tmp.msg
129 From: Olly Betts <olly@survex.com>
130 To: xapian-discuss@lists.xapian.org
131 Subject: Xapian $version released
132 Reply-To: xapian-discuss@lists.xapian.org
133 Content-Type: multipart/signed; micalg=pgp-sha512;
134 protocol="application/pgp-signature"; boundary="=-=-=-=-=-=-=--"
135 Content-Disposition: inline
137 --=-=-=-=-=-=-=--
138 Content-Type: text/plain; charset=utf-8
139 Content-Disposition: inline
140 Content-Transfer-Encoding: 8bit
142 Xapian $version can now be downloaded from:
144 https://xapian.org/download
146 This release is mainly composed of
147 optimisations,
148 FIXME
150 bug fixes.
152 The wiki has the usual summary of the most notable changes:
154 https://trac.xapian.org/wiki/ReleaseOverview/$version
156 A big thanks to
157 FIXME
158 for helping to make this release a reality.
160 If I've missed anyone out, you can claim an extra big thankyou.
162 As always, if you encounter problems, please report them here, or to
163 the bug-tracker: https://xapian.org/bugs
165 You can find detached GPG signatures for each of the release tarballs
166 in a corresponding file with ".asc" appended.
168 Here are the SHA256 checksums of the released files:
170 $checksums
172 Cheers,
173 Olly
175 --=-=-=-=-=-=-=--
176 Content-Type: application/pgp-signature; name="signature.asc"
178 -----BEGIN PGP SIGNATURE-----
179 -----END PGP SIGNATURE-----
181 --=-=-=-=-=-=-=--
183 mutt -E -H tmp.msg
184 echo 'Hit enter to push branch and new tag'
185 read dummy
186 git push
187 git push --tags "$tag"