This module is distributed via npm which is bundled with node and
should be installed as one of your project's devDependencies:
npm install --save-dev semantic-release-chromeThis package provides a set of semantic-release plugins for you to easily publish Chrome extensions automatically.
Besides creating a release on the Chrome webstore, it also writes the correct version to the manifest.json and creates a zip file containing everything inside the dist folder, so you can use the official @semantic-release/github plugin and upload the release to the GitHub releases page, so your users can easily rollback to an earlier version if a newer one introduces a bad bug.
This package export the following plugins:
Verify the presence of the authentication parameters, which are set via environment variables (see Chrome webstore authentication).
Writes the correct version to the manifest.json and creates a zip file with everything inside the dist folder.
This plugin requires some parameters to be set, so be sure to check below and fill them accordingly.
-
asset: REQUIRED parameter. The filename of the zip file. -
distFolder: The folder that will be zipped. Defaults todist. -
manifestPath: The path of themanifest.jsonfile inside the dist folder. Defaults to<distFolder parameter>/manifest.json.
Uploads the generated zip file to the webstore and publishes a new release.
-
extensionId: REQUIRED parameter. Theextension idfrom the webstore. For example: If the url of your extension is https://chrome.google.com/webstore/detail/webplayer-hotkeys-shortcu/ikmkicnmahfdilneilgibeppbnolgkaf, then the last portion,ikmkicnmahfdilneilgibeppbnolgkaf, will be theextension id. You can also take this ID on the developers dashboard, under the nameItem IDlocated inside theMore infodialog.Unfortunately, due to Google's restrictions, this plugin can only publish extensions that already exists on the store, so you will have to at least make a draft release for yourself, so the plugin can create a proper release for the first time. You can create a draft release with just a minimum
manifest.jsonwith version0.0.1compressed in a zip file.If you decide to make the draft, make sure to fill all the required fields on the drafts page, otherwise the publishing will fail with a
400status code (Bad request). -
asset: REQUIRED parameter. The zip file that will be published to the chrome webstore. -
target: can bedefaultortrustedTesters. When released using the first, the extension will be publicly available to everyone. WhentrustedTestersis used, it will be released as a private extension. Defaults todefault.
You will need to get three parameters from the Google API: a clientId, a clientSecret and a refreshToken. For more information on how to get those parameters and how to set the environment variables which are required in order for this plugin to work properly, read this guide.
Use semantic-release-chrome as part of verifyConditions, prepare and publish.
A basic configuration file example is available below:
{
"verifyConditions": ["semantic-release-chrome", "@semantic-release/github"],
"prepare": [
{
"path": "semantic-release-chrome",
"asset": "my-extension.zip"
}
],
"publish": [
{
"path": "semantic-release-chrome",
"asset": "my-extension.zip",
"extensionId": "mppjhhbajcciljocgbadbhbgphjfdmhj"
},
{
"path": "@semantic-release/github",
"assets": [
{
"path": "my-extension.zip"
}
]
}
]
}For more info about each config, see the parameters for each plugin.
For more info on the configuration file, see the configuration file documentation on the semantic-release repository.
MIT