[bmap-tools] [PATCH 4/5] make_a_release.sh: a script for cutting releases

Artem Bityutskiy dedekind1 at gmail.com
Tue Aug 6 04:30:33 EDT 2013


From: Artem Bityutskiy <artem.bityutskiy at intel.com>

Not complete, but a good start anyway. Intended to be used by me.

Change-Id: I64b7ef72ac8fe729f234f5d74847dc85225ccee0
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at intel.com>
---
 make_a_release.sh | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 118 insertions(+)
 create mode 100755 make_a_release.sh

diff --git a/make_a_release.sh b/make_a_release.sh
new file mode 100755
index 0000000..5426f99
--- /dev/null
+++ b/make_a_release.sh
@@ -0,0 +1,118 @@
+#!/bin/sh -euf
+#
+# Copyright (c) 2012-2013 Intel, Inc.
+# License: GPLv2
+# Author: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+# This script automates the process of releasing the bmap-tools project. The
+# idea is that it should be enough to run this script with few parameters and
+# the release is ready.
+#
+# This script is supposed to be executed in the root of the bmap-tools
+# project's source code tree. The checked-out branch has to be 'devel'.
+#
+# TODO:
+#   * support -rc releases;
+#   * update the version field in all places, the rpm/deb changelog and commit
+#     that.
+
+fatal() {
+        printf "Error: %s\n" "$1" >&2
+        exit 1
+}
+
+usage() {
+        cat <<EOF
+Usage: ${0##*/} <new_ver> <outdir>
+
+<new_ver>  - new bmap-tools version to make in X.Y format
+EOF
+        exit 0
+}
+
+[ $# -eq 0 ] && usage
+[ $# -eq 1 ] || fatal "insufficient or too many argumetns"
+
+new_ver="$1"; shift
+
+# Validate the new version
+printf "%s" "$new_ver" | egrep -q -x '[[:digit:]]+\.[[:digit:]]+' ||
+        fatal "please, provide new version in X.Y format"
+
+# Make sure the 'devel' branch is currently checked out
+current_branch="$(git branch | sed -n -e '/^*/ s/^* //p')"
+if [ "$current_branch" != "devel" ]; then
+	fatal "current branch is '$current_branch' but must be 'devel'"
+fi
+
+# Make sure the git index is up-to-date
+[ -z "$(git status --porcelain)" ] || fatal "git index is not up-to-date"
+
+outdir="."
+tag_name="v$new_ver"
+release_name="bmap-tools-$new_ver"
+
+# Create new signed tag
+echo "Signing tag $tag_name"
+git tag -m "$release_name" -s "$tag_name"
+
+# Prepare a signed tarball
+git archive --format=tar --prefix="$release_name/" "$tag_name" | \
+        gzip > "$outdir/$release_name.tgz"
+echo "Signing the tarball"
+gpg -o "$outdir/$release_name.tgz.asc" --detach-sign -a "$outdir/$release_name.tgz"
+
+# Get the name of the release branch corresponding to this version
+release_branch="release-$(printf "%s" "$new_ver" | sed -e 's/\(.*\)\..*/\1.0/')"
+
+cat <<EOF
+Make sure you have had updated the docs/RELEASE_NOTES file!
+Make sure you have had updated the version number and rpm/deb changelogs
+
+To finish the release:
+  1. push the $tag_name tag out
+  2. copy the tarball to ftp.infradead.org
+  3. push the changes to the $release_branch branch
+  4. point the master branch to the updated $release_branch branch
+  5. push the master, $release_branch, and devel branches out
+  4. announce the new release in the public mailing list
+
+The commands would be:
+
+#1
+git push origin $tag_name
+git push public $tag_name
+#2
+scp "$outdir/$release_name.tgz" "$outdir/$release_name.tgz.asc" casper.infradead.org:/var/ftp/pub/bmap-tools/
+#3
+git branch -f $release_branch devel
+#4
+git branch -f master $release_branch
+#5
+git push origin master:master
+git push origin $release_branch:$release_branch
+git push origin devel:devel
+git push public master:master
+git push public $release_branch:$release_branch
+git push public devel:devel
+#6
+mutt -H /proc/self/fd/0 -x <<END_OF_EMAIL
+From: Artem Bityutskiy <dedekind1 at gmail.com>
+To: Artem Bityutskiy <artem.bityutskiy at intel.com>
+Subject: Announcement: $release_name is out!
+
+Bmap-tools version $new_ver is out!
+
+Release notes: http://git.infradead.org/users/dedekind/bmap-tools.git/blob/refs/heads/devel:/docs/RELEASE_NOTES
+Tarball: ftp://ftp.infradead.org/pub/bmap-tools/
+END_OF_EMAIL
+EOF
-- 
1.8.1.4




More information about the Bmap-tools mailing list