Add Chromium Canary target

The mv3 variant will be used for this target, to start testing it.

Bug: translateselectedtext:10
Change-Id: I0bc5d715d03b2ef9a7514e107d56c66703f05060
diff --git a/Makefile b/Makefile
index ec00ad4..3ae08af 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: node_deps clean_dist deps clean_deps serve_chromium serve_chromium_mv3 serve_edge serve_edge_mv3 release release_chromium_stable release_chromium_beta release_edge build_test_extension clean_releases clean
+.PHONY: node_deps clean_dist deps clean_deps serve_chromium serve_chromium_mv3 serve_edge serve_edge_mv3 release release_chromium_stable release_chromium_beta release_chromium_canary release_edge build_test_extension clean_releases clean
 
 .DEFAULT_GOAL := release
 WEBPACK := ./node_modules/webpack-cli/bin/cli.js
@@ -41,6 +41,11 @@
 	$(RELEASE_SCRIPT) -c beta -b chromium -f
 	rm -rf dist/chromium
 
+release_chromium_canary: deps
+	$(WEBPACK) --mode production --env browser_target=chromium_mv3 --env canary
+	$(RELEASE_SCRIPT) -c canary -b chromium_mv3 -f
+	rm -rf dist/chromium_mv3
+
 release_edge: deps
 	$(WEBPACK) --mode production --env browser_target=edge
 	$(RELEASE_SCRIPT) -c stable -b edge -f
diff --git a/src/icons/canary/translate-128.png b/src/icons/canary/translate-128.png
new file mode 100644
index 0000000..ec2f5d5
--- /dev/null
+++ b/src/icons/canary/translate-128.png
Binary files differ
diff --git a/src/icons/canary/translate-16.png b/src/icons/canary/translate-16.png
new file mode 100644
index 0000000..ea83201
--- /dev/null
+++ b/src/icons/canary/translate-16.png
Binary files differ
diff --git a/src/icons/canary/translate-256.png b/src/icons/canary/translate-256.png
new file mode 100644
index 0000000..0000685
--- /dev/null
+++ b/src/icons/canary/translate-256.png
Binary files differ
diff --git a/src/icons/canary/translate-32.png b/src/icons/canary/translate-32.png
new file mode 100644
index 0000000..4128363
--- /dev/null
+++ b/src/icons/canary/translate-32.png
Binary files differ
diff --git a/src/icons/canary/translate-512.png b/src/icons/canary/translate-512.png
new file mode 100644
index 0000000..f1bea60
--- /dev/null
+++ b/src/icons/canary/translate-512.png
Binary files differ
diff --git a/src/icons/canary/translate-64.png b/src/icons/canary/translate-64.png
new file mode 100644
index 0000000..436e6f3
--- /dev/null
+++ b/src/icons/canary/translate-64.png
Binary files differ
diff --git a/src/icons/translate-128.png b/src/icons/regular/translate-128.png
similarity index 100%
rename from src/icons/translate-128.png
rename to src/icons/regular/translate-128.png
Binary files differ
diff --git a/src/icons/translate-16.png b/src/icons/regular/translate-16.png
similarity index 100%
rename from src/icons/translate-16.png
rename to src/icons/regular/translate-16.png
Binary files differ
diff --git a/src/icons/translate-256.png b/src/icons/regular/translate-256.png
similarity index 100%
rename from src/icons/translate-256.png
rename to src/icons/regular/translate-256.png
Binary files differ
diff --git a/src/icons/translate-32.png b/src/icons/regular/translate-32.png
similarity index 100%
rename from src/icons/translate-32.png
rename to src/icons/regular/translate-32.png
Binary files differ
diff --git a/src/icons/translate-512.png b/src/icons/regular/translate-512.png
similarity index 100%
rename from src/icons/translate-512.png
rename to src/icons/regular/translate-512.png
Binary files differ
diff --git a/src/icons/translate-64.png b/src/icons/regular/translate-64.png
similarity index 100%
rename from src/icons/translate-64.png
rename to src/icons/regular/translate-64.png
Binary files differ
diff --git a/src/static/_locales/en/messages.json b/src/static/_locales/en/messages.json
index 07ffcfb..d8bd3cf 100644
--- a/src/static/_locales/en/messages.json
+++ b/src/static/_locales/en/messages.json
@@ -7,6 +7,10 @@
 		"message": "Translate Selected Text (Beta)",
 		"description": "The beta app name"
 	},
+  "appCanaryName": {
+		"message": "Translate Selected Text (Canary)",
+		"description": "The beta app name"
+	},
 	"appDescription": {
 		"message": "Translate selected text with Google Translate",
 		"description": "The app description"
diff --git a/tools/release.bash b/tools/release.bash
index 2546e85..d5f634d 100644
--- a/tools/release.bash
+++ b/tools/release.bash
@@ -12,8 +12,8 @@
 
   optional arguments:
     -h, --help     show this help message and exit
-    -c, --channel  indicates the channel of the release. Can be "beta"
-                   or "stable". Defaults to "stable".
+    -c, --channel  indicates the channel of the release. Can be "beta",
+                   "stable" or "canary". Defaults to "stable".
     -b, --browser  indicates the target browser for the release. Can be
                    "chromium", "chromium_mv3, "edge" or "edge_mv3".
                    Defaults to "chromium".
@@ -58,7 +58,7 @@
   esac
 done
 
-if [[ $channel != "stable" && $channel != "beta" ]]; then
+if [[ $channel != "stable" && $channel != "beta" && $channel != "canary" ]]; then
   echo "channel parameter value is incorrect." >&2
   usage
   exit
@@ -83,17 +83,30 @@
 # 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"
+  if [[ $channel == "canary" && $version == "v"* && \
+    $version != *"dirty" ]]; then
+    # If we're releasing a canary build and the build is not dirty,
+    # generate a version number
+    IFS='-' read -ra versionExplode <<< "${version:1}"
+    versionCanary="${versionExplode[0]}.${versionExplode[1]}"
+    set_manifest_field "version" "$versionCanary"
+    set_manifest_field "version_name" "$versionCanary-$channel"
+  else
+    # 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"
+  fi
 else
   # It is a release version, set the version fields accordingly.
   set_manifest_field "version" "${version:1}"
   set_manifest_field "version_name" "${version:1}-$channel"
 fi
 
-if [[ $channel == "beta" ]]; then
+if [[ $channel == "canary" ]]; then
+  # Change manifest.json to label the release as canary
+  set_manifest_field "name" "__MSG_appCanaryName__"
+elif [[ $channel == "beta" ]]; then
   # Change manifest.json to label the release as beta
   set_manifest_field "name" "__MSG_appBetaName__"
 fi
diff --git a/webpack.config.js b/webpack.config.js
index c66738d..ec70593 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -20,6 +20,7 @@
       params: {
         browser_target: env.browser_target,
         production: args.mode == 'production',
+        canary: !!env.canary,
       },
     },
   };
@@ -43,7 +44,8 @@
       new CopyWebpackPlugin({
         patterns: [
           {
-            from: path.join(__dirname, 'src/icons'),
+            from: path.join(
+                __dirname, 'src/icons', env.canary ? 'canary' : 'regular'),
             to: path.join(outputPath, 'icons'),
           },
         ]