Added release scripts
diff --git a/.gitignore b/.gitignore
index 4e97e6d..ec335e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
console_inject_deprecated.js
+out
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6d365c6
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+# Infinite scroll in TW
+[![Available in the Chrome Web Store](https://developer.chrome.com/webstore/images/ChromeWebStore_Badge_v2_206x58.png)](https://chrome.google.com/webstore/detail/infinite-scroll-in-tw/hpgakoecmgibigdbnljgecablpipbajb)
+
+## Build extension in order to upload to the Chrome Web Store
+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.
+
diff --git a/release.bash b/release.bash
new file mode 100644
index 0000000..f1e89fd
--- /dev/null
+++ b/release.bash
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+# Prints help text
+function usage() {
+ cat << END
+
+ Usage: $progname [--channel CHANNEL]
+
+ optional arguments:
+ -h, --help show this help message and exit
+ -c, --channel indicates the channel of the release. Can be "beta" or "stable".
+
+END
+}
+
+# Get options
+opts=$(getopt -l "help,channel:" -o "hc:" -n "$progname" -- "$@")
+eval set -- "$opts"
+
+channel=stable
+
+while true; do
+ case "$1" in
+ -h | --help ) usage; exit; ;;
+ -c | --channel ) channel="$2"; shift 2 ;;
+ * ) break ;;
+ esac
+done
+
+if [[ $channel != "stable" && $channel != "beta" ]]; then
+ echo "channel parameter value is incorrect."
+ usage
+ exit
+fi
+
+echo "Started building release..."
+
+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
+fi
+
+# Create ZIP file for upload to the Chrome Web Store
+mkdir -p out
+rm -rf out/infinitegforums-$channel.zip
+zip -rq out/infinitegforums-$channel.zip src -x *.git*
+
+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
+fi
+
+echo "Done!"
diff --git a/LICENSE b/src/LICENSE
similarity index 100%
rename from LICENSE
rename to src/LICENSE
diff --git a/_locales/ca/messages.json b/src/_locales/ca/messages.json
similarity index 100%
rename from _locales/ca/messages.json
rename to src/_locales/ca/messages.json
diff --git a/_locales/en/messages.json b/src/_locales/en/messages.json
similarity index 100%
rename from _locales/en/messages.json
rename to src/_locales/en/messages.json
diff --git a/_locales/es/messages.json b/src/_locales/es/messages.json
similarity index 100%
rename from _locales/es/messages.json
rename to src/_locales/es/messages.json
diff --git a/background.js b/src/background.js
similarity index 100%
rename from background.js
rename to src/background.js
diff --git a/console_inject.js b/src/console_inject.js
similarity index 100%
rename from console_inject.js
rename to src/console_inject.js
diff --git a/console_inject_start.js b/src/console_inject_start.js
similarity index 100%
rename from console_inject_start.js
rename to src/console_inject_start.js
diff --git a/forum_inject.js b/src/forum_inject.js
similarity index 100%
rename from forum_inject.js
rename to src/forum_inject.js
diff --git a/icons/128.png b/src/icons/128.png
similarity index 100%
rename from icons/128.png
rename to src/icons/128.png
Binary files differ
diff --git a/icons/512.png b/src/icons/512.png
similarity index 100%
rename from icons/512.png
rename to src/icons/512.png
Binary files differ
diff --git a/manifest.json b/src/manifest.json
similarity index 100%
rename from manifest.json
rename to src/manifest.json
diff --git a/options.css b/src/options.css
similarity index 100%
rename from options.css
rename to src/options.css
diff --git a/options.html b/src/options.html
similarity index 100%
rename from options.html
rename to src/options.html
diff --git a/options.js b/src/options.js
similarity index 100%
rename from options.js
rename to src/options.js
diff --git a/profile_inject.js b/src/profile_inject.js
similarity index 100%
rename from profile_inject.js
rename to src/profile_inject.js
diff --git a/thread_inject.js b/src/thread_inject.js
similarity index 100%
rename from thread_inject.js
rename to src/thread_inject.js