Tagging process streamlined
A tagRelease.bash script is created in order to streamline the tagging
process. Now tag messages contain a link to the changelog between
versions.
Change-Id: I14effc4e7586f5d41e5c1df5561350fbe5dc48b7
diff --git a/README.md b/README.md
index c3bf730..ca81554 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,8 @@
1. Tag the last commit with a version number (in the format `vx`, where x is the
extension's [version number](https://developer.chrome.com/extensions/manifest/version)
-for that release) by running `git tag -a vx -m "vx"`. Note that the tag should
-be an annotated tag and not a lightweight tag, and it must be pushed to Gerrit
-after being created.
+for that release) by running `bash tagRelease.bash --version vx`. Note that the
+tag must be pushed to Gerrit after being created.
2. Build the extension for both the stable and beta channels (this is explained
in the next section). This will output a ZIP file for each release channel and
each supported browser.
diff --git a/release.bash b/release.bash
index e261c37..a18d51b 100644
--- a/release.bash
+++ b/release.bash
@@ -6,7 +6,7 @@
function usage() {
cat <<END
- Usage: $progname [--channel CHANNEL]
+ Usage: $progname [--channel CHANNEL --browser BROWSER]
optional arguments:
-h, --help show this help message and exit
diff --git a/tagRelease.bash b/tagRelease.bash
new file mode 100644
index 0000000..bc269ca
--- /dev/null
+++ b/tagRelease.bash
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# Tags the current git HEAD as a new version, passed via a flag.
+
+GITILES_REPO_URL="https://gerrit.avm99963.com/plugins/gitiles/infinitegforums"
+
+# Prints help text
+function usage() {
+ cat <<END
+
+ Usage: $progname --version VERSION
+
+ required arguments:
+ -v, --version the version of the new release (in the form vx)
+ which wants to be tagged.
+
+ optional arguments:
+ -h, --help show this help message and exit
+
+END
+}
+
+opts=$(getopt -l "help,version:" -o "hv:" -n "$progname" -- "$@")
+eval set -- "$opts"
+
+prevVersion=$(git describe --abbrev=0)
+nextVersion="null"
+
+while true; do
+ case "$1" in
+ -h | --help)
+ usage
+ exit
+ ;;
+ -v | --version)
+ nextVersion="$2"
+ shift 2
+ ;;
+ *) break ;;
+ esac
+done
+
+if [[ $nextVersion == "null" ]]; then
+ echo "version parameter value is incorrect." >&2
+ usage
+ exit
+fi
+
+commitMessage="Changelog: $GITILES_REPO_URL/+log/refs/tags/$prevVersion..refs/tags/$nextVersion"
+git tag -a $nextVersion -m "$commitMessage"
+
+echo "Tag created. Now run \`git push --tags\` to push the tags to the server."