Change the release system to a tag-based system

Before, releases were created by commiting a change to the manifest.json
file which updated the "version" field.

This commit changes this procedure by generating the version strings
directly in the release.bash script with the "git describe" command,
based on annotated Git tags.

Change-Id: I4de4e1040b7e9d22b4d3c8df9c0870989d966c49
diff --git a/ b/
index 0b4e035..0bec612 100644
--- a/
+++ b/
@@ -1,11 +1,30 @@
 # Infinite scroll in TW
 [![Available in the Chrome Web Store](](
-## Build extension in order to upload to the Chrome Web Store
+## Release cycle
+When the code in the `master` branch is considered to be stable, a release can be made. This is the procedure:
+1. Tag the last commit with a version number (in the format `vx`, where x is the extension's [version number]( 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.
+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.
+3. [Upload both release files]( to the Chrome Web Store, one for each release channel.
+4. [Submit both releases]( to be reviewed by the Chrome Web Store team, but in the case of the stable channel uncheck the "Publish automatically after it has passed review" option.
+5. Upload the beta release file to the [GitHub releases page]( under the newly created tag. Mark that release as a pre-release at GitHub.
+6. Wait until the beta release is reviewed and approved by Google.
+7. Test again the extension by using the beta channel. Check if the options have been transfered correctly from version to version, and wait some days (for instance between 3 and 5 days) to see if other people report issues with the updated version.
+8. If everything goes well, publish the update in the stable channel. The updated version should have already been reviewed by the Chrome Web Store team at this time.
+9. Update the release file in the GitHub releases page by removing the beta release file and uploading the stable release file. Also, remove the pre-release label.
+If during this process the release wasn't approved by Google or an issue was found during beta testing, a new release which fixes this should be created.
+## Build the extension
 To create a zip file with the contents of the extension, which can be uploaded to the Chrome Web Store, run `bash release.bash`. You can also use `bash release.bash --channel=beta` to include a beta label in the extension name and version of the resulting zip file.
-The zip file will be located in the `out` folder.
+The ZIP file will contain a manifest.json file with the according version name, and will be located in the `out` folder.
+You can also get information about how to use the `release.bash` script by running `bash release.bash -h`.
 ## Testing notes
 To test translations, you might want to set your browser's locale. This section tells you how to set the locale in [Windows](, [Mac OS X](, [Linux](, and [Chrome OS](
+## Beta channel
+The beta channel is available [here](
diff --git a/release.bash b/release.bash
index f1e89fd..4e6a436 100644
--- a/release.bash
+++ b/release.bash
@@ -1,9 +1,9 @@
 # Prints help text
-function usage() {
+function usage {
   cat << END
   Usage: $progname [--channel CHANNEL]
   optional arguments:
@@ -13,6 +13,11 @@
+# Updates manifest.json field
+function set_manifest_field {
+  sed -i -E "s/\"$1\": \"[^\"]*\"/\"$1\": \"$2\"/" src/manifest.json
 # Get options
 opts=$(getopt -l "help,channel:" -o "hc:" -n "$progname" -- "$@")
 eval set -- "$opts"
@@ -35,10 +40,25 @@
 echo "Started building release..."
+# This is the version name which git gives us
+version=$(git describe --always --tags --dirty)
+# If the version name contains a hyphen then it isn't a release
+# version. This is also the case if it doesn't start with a "v".
+if [[ $version == *"-"* || $version != "v"* ]]; then
+  # As it isn't a release version, setting version number to 0 so it
+  # cannot be uploaded to the Chrome Web Store
+  set_manifest_field "version" "0"
+  set_manifest_field "version_name" "$version-$channel"
+  # It is a release version, set the version fields accordingly.
+  set_manifest_field "version" "${version:1}"
+  set_manifest_field "version_name" "${version:1}-$channel"
 if [[ $channel == "beta" ]]; then
   # Change manifest.json to label the release as beta
-  sed -i 's/"name": "[^"]*"/"name": "__MSG_appNameBeta__"/' src/manifest.json
-  sed -i -r 's/"version": "([^"]*)",/"version": "\1",\n  "version_name": "\1-beta",/' src/manifest.json
+  set_manifest_field "name" "__MSG_appNameBeta__"
 # Create ZIP file for upload to the Chrome Web Store
@@ -46,10 +66,11 @@
 rm -rf out/infinitegforums-$
 zip -rq out/infinitegforums-$ src -x *.git*
+# Revert manifest.json changes
+set_manifest_field "version" "0"
+set_manifest_field "version_name" "dirty"
 if [[ $channel == "beta" ]]; then
-  # Revert manifest.json changes
-  sed -i 's/"name": "[^"]*"/"name": "__MSG_appName__"/' src/manifest.json
-  sed -i '/"version_name"/d' src/manifest.json
+  set_manifest_field "name" "__MSG_appName__"
 echo "Done!"
diff --git a/src/manifest.json b/src/manifest.json
index 2b87baf..0b753d8 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,7 +1,8 @@
   "manifest_version": 2,
   "name": "__MSG_appName__",
-  "version": "0.8",
+  "version": "0",
+  "version_name": "dirty",
   "description": "__MSG_appDescription__",
   "icons": {
     "512": "icons/512.png",