/tig-1.0/contrib/release.sh
Shell | 75 lines | 33 code | 14 blank | 28 comment | 4 complexity | e1942f3807b1963759ea29c39a1c0b43 MD5 | raw file
Possible License(s): GPL-2.0
1#!/bin/sh
2#
3# Script for preparing a release or updating the release branch.
4# Usage: $0 version
5#
6# Copyright (c) 2009-2012 Jonas Fonseca <fonseca@diku.dk>
7#
8# This program is free software; you can redistribute it and/or
9# modify it under the terms of the GNU General Public License as
10# published by the Free Software Foundation; either version 2 of
11# the License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17
18set -e
19set -x
20
21VERSION="$1"
22
23TAG="tig-$VERSION"
24TITLE="$TAG\n$(echo "$TAG" | sed 's/./-/g')"
25
26# Require a clean repository.
27git update-index --refresh
28git diff-index --quiet HEAD
29
30if test -n "$VERSION"; then
31 # Get a sane starting point.
32 test "$(git symbolic-ref HEAD)" = "refs/heads/master" ||
33 git checkout master
34
35 # Update files which should reference the version.
36 sed -i "s/VERSION\s=\s[0-9]\+[.][0-9]\+/VERSION = $VERSION/" Makefile
37 perl -pi -e 's/^tig master.*/@@TITLE@@/ms' NEWS
38 perl -pi -e "s/^@@TITLE@@.*/$TITLE/" NEWS
39
40 # Check for typos.
41 make spell-check
42
43 # Last review.
44 $EDITOR NEWS
45
46 # Create release commit and tag.
47 git commit -a -m "$TAG"
48 git tag -s -m "tig version $VERSION" "$TAG"
49
50 # Prepare release announcement file.
51 ./contrib/announcement.sh "$TAG" > "$TAG.txt"
52
53 # Set version for the Makefile
54 export DIST_VERSION="$VERSION"
55else
56 # Get meaningful version for the update message.
57 TAG="$(git describe)"
58fi
59
60# Update the release branch.
61git checkout release
62HEAD="$(git rev-parse release)"
63git merge master
64if test -n "$(git rev-list -1 release ^$HEAD)"; then
65 make distclean doc-man doc-html sysconfdir=++SYSCONFDIR++
66 git commit -a -m "Update for version $TAG"
67fi
68
69if test -n "$VERSION"; then
70 # Create the tarball.
71 make dist
72fi
73
74# Done.
75git checkout master