How We Implement CD (Continuous Deployment) for TinySnap

This article briefly introduces some of our in-house practices on CD (Continuous Deployment) of TinySnap browser extension to popular Web Stores.

How We Implement CD (Continuous Deployment) for TinySnap
Photo by Fotis Fotopoulos / Unsplash

TinySnap screenshot tool is available for Google Chrome (as well as all Chromium-based browsers such as Opera, Brave, Microsoft Edge, etc.) and Mozilla Firefox. The more browsers we support, the more web store platforms we need to submit TinySnap to. Manual submission sometimes causes mistakes, so we want to automate the process.

This article briefly introduces some of our in-house practices on CD (Continuous Deployment) of TinySnap browser extension to popular Web Stores.

Chrome Web Store

Chrome has an official Web Store API, but there's no public tool to push the changes.

So we used a 3rd-party command line tool - chrome-webstore-upload-cli to upload the packed file,extension.zip. Before you get started with this command line tool, you need to fetch clientId, clientSecret, and a refreshToken from Google API . Here's an article instructing how to do it.

Below is a sample bash script that shows how we submitted the packed extension.zip to the Chrome Web Store.

$ chrome-webstore-upload upload --source extension.zip --extension-id $EXTENSION_ID --client-id $CLIENT_ID --client-secret $CLIENT_SECRET --refresh-token $REFRESH_TOKEN

AMO

Mozilla has published an open-source command line tool, web-ext to help build, run, and test web extensions. However, web-ext is missing a submit function, you can find the discussion on the same topic on mozilla/web-ext#804.

After research, we found a solution called web-ext-submit. The wrapper executes the web-ext sign command, but then it prevents the unrelated "it could not be signed" error.

To submit the packed file, ie. extension.zip, execute the following command:

$ web-ext-submit --api-key=$WEB_EXT_API_KEY --api-secret=$WEB_EXT_API_SECRET

You may fetch the apiKey and apiSecret by going through this article.

Microsoft Edge Web Store

Microsoft Edge also has its Edge Add-ons API, but it doesn't come with a command line. Hence we made one by ourselves (you may find it here: edge-addons-upload-cli) . Before you get down to it, you need to get a productId, clientId, clientSecret, and accessTokenUrl for your extension. These parameters can be found in this article.

$ edge-addons-upload upload --source extension.zip --product-id $PRODUCT_ID --client-id $CLIENT_ID --client-secret $CLIENT_SECRET --access-token-url $ACCESS_TOKEN_URL

Conclusion

Above is how we implement Continuous Deployment on mainstream web store platforms. It significantly saves our time when compared contrary to manual submission. And it avoids mistakes prone to manual submissions. If you are a developer who's using a different approach, free free to let us know your method(s).

Thank you for reading!