blob: f1e89fdded14ae225db1025e04fee94b73576f99 [file] [log] [blame]
avm9996303d54092020-01-18 21:33:16 +01001#!/bin/bash
2
3# Prints help text
4function usage() {
5 cat << END
6
7 Usage: $progname [--channel CHANNEL]
8
9 optional arguments:
10 -h, --help show this help message and exit
11 -c, --channel indicates the channel of the release. Can be "beta" or "stable".
12
13END
14}
15
16# Get options
17opts=$(getopt -l "help,channel:" -o "hc:" -n "$progname" -- "$@")
18eval set -- "$opts"
19
20channel=stable
21
22while true; do
23 case "$1" in
24 -h | --help ) usage; exit; ;;
25 -c | --channel ) channel="$2"; shift 2 ;;
26 * ) break ;;
27 esac
28done
29
30if [[ $channel != "stable" && $channel != "beta" ]]; then
31 echo "channel parameter value is incorrect."
32 usage
33 exit
34fi
35
36echo "Started building release..."
37
38if [[ $channel == "beta" ]]; then
39 # Change manifest.json to label the release as beta
40 sed -i 's/"name": "[^"]*"/"name": "__MSG_appNameBeta__"/' src/manifest.json
41 sed -i -r 's/"version": "([^"]*)",/"version": "\1",\n "version_name": "\1-beta",/' src/manifest.json
42fi
43
44# Create ZIP file for upload to the Chrome Web Store
45mkdir -p out
46rm -rf out/infinitegforums-$channel.zip
47zip -rq out/infinitegforums-$channel.zip src -x *.git*
48
49if [[ $channel == "beta" ]]; then
50 # Revert manifest.json changes
51 sed -i 's/"name": "[^"]*"/"name": "__MSG_appName__"/' src/manifest.json
52 sed -i '/"version_name"/d' src/manifest.json
53fi
54
55echo "Done!"