Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 860d89a

Browse files
committed
make_a_release.sh: a script for cutting releases
Not complete, but a good start anyway. Intended to be used by me. Change-Id: I64b7ef72ac8fe729f234f5d74847dc85225ccee0 Signed-off-by: Artem Bityutskiy <[email protected]>
1 parent 2e753dc commit 860d89a

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

make_a_release.sh

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/bin/sh -euf
2+
#
3+
# Copyright (c) 2012-2013 Intel, Inc.
4+
# License: GPLv2
5+
# Author: Artem Bityutskiy <[email protected]>
6+
#
7+
# This program is free software; you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License, version 2,
9+
# as published by the Free Software Foundation.
10+
#
11+
# This program is distributed in the hope that it will be useful, but
12+
# WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
# General Public License for more details.
15+
16+
# This script automates the process of releasing the bmap-tools project. The
17+
# idea is that it should be enough to run this script with few parameters and
18+
# the release is ready.
19+
20+
#
21+
# This script is supposed to be executed in the root of the bmap-tools
22+
# project's source code tree.
23+
#
24+
# TODO:
25+
# * support -rc releases;
26+
# * update the version field in all places, the rpm/deb changelog and commit
27+
# that.
28+
29+
fatal() {
30+
printf "Error: %s\n" "$1" >&2
31+
exit 1
32+
}
33+
34+
usage() {
35+
cat <<EOF
36+
Usage: ${0##*/} <new_ver> <outdir>
37+
38+
<new_ver> - new bmap-tools version to make in X.Y format
39+
EOF
40+
exit 0
41+
}
42+
43+
[ $# -eq 0 ] && usage
44+
[ $# -eq 1 ] || fatal "insufficient or too many argumetns"
45+
46+
new_ver="$1"; shift
47+
48+
# Validate the new version
49+
printf "%s" "$new_ver" | egrep -q -x '[[:digit:]]+\.[[:digit:]]+' ||
50+
fatal "please, provide new version in X.Y format"
51+
52+
# Get the name of the release branch corresponding to this version
53+
release_branch="release-$(printf "%s" "$new_ver" | sed -e 's/\(.*\)\..*/\1.0/')"
54+
55+
# Make sure that a release branch branch is currently checked out
56+
current_branch="$(git branch | sed -n -e '/^*/ s/^* //p')"
57+
if [ "$current_branch" != "$release_branch" ]; then
58+
fatal "current branch is '$current_branch' but must be '$release_branch'"
59+
fi
60+
61+
# Make sure the git index is up-to-date
62+
[ -z "$(git status --porcelain)" ] || fatal "git index is not up-to-date"
63+
64+
outdir="."
65+
tag_name="v$new_ver"
66+
release_name="bmap-tools-$new_ver"
67+
68+
# Create new signed tag
69+
echo "Signing tag $tag_name"
70+
git tag -m "$release_name" -s "$tag_name"
71+
72+
# Prepare a signed tarball
73+
git archive --format=tar --prefix="$release_name/" "$tag_name" | \
74+
gzip > "$outdir/$release_name.tgz"
75+
echo "Signing the tarball"
76+
gpg -o "$outdir/$release_name.tgz.asc" --detach-sign -a "$outdir/$release_name.tgz"
77+
78+
# Get the name of the release branch corresponding to this version
79+
release_branch="release-$(printf "%s" "$new_ver" | sed -e 's/\(.*\)\..*/\1.0/')"
80+
81+
cat <<EOF
82+
Make sure you have had updated the docs/RELEASE_NOTES file!
83+
Make sure you have had updated the version number and rpm/deb changelogs
84+
85+
To finish the release:
86+
1. push the $tag_name tag out
87+
2. copy the tarball to ftp.infradead.org
88+
3. point the master branch to the updated $release_branch branch
89+
4. push the master and the $release_branch branches out
90+
5. announce the new release in the public mailing list
91+
92+
The commands would be:
93+
94+
#1
95+
git push origin $tag_name
96+
git push public $tag_name
97+
#2
98+
scp "$outdir/$release_name.tgz" "$outdir/$release_name.tgz.asc" casper.infradead.org:/var/ftp/pub/bmap-tools/
99+
#3
100+
git branch -f master $release_branch
101+
#4
102+
git push origin master:master
103+
git push origin $release_branch:$release_branch
104+
git push public master:master
105+
git push public $release_branch:$release_branch
106+
#5
107+
mutt -H /proc/self/fd/0 -x <<END_OF_EMAIL
108+
From: Artem Bityutskiy <[email protected]>
109+
110+
Subject: Announcement: $release_name is out!
111+
112+
Bmap-tools version $new_ver is out!
113+
114+
Release notes: http://git.infradead.org/users/dedekind/bmap-tools.git/blob/refs/heads/$release_branch:/docs/RELEASE_NOTES
115+
Tarball: ftp://ftp.infradead.org/pub/bmap-tools/
116+
END_OF_EMAIL
117+
EOF

0 commit comments

Comments
 (0)