@pohy/semantic-release-chrome v0.1.1
Installation
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-chromeDescription
This 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.
Usage
This package export the following plugins:
verifyConditions
Verify the presence of the authentication parameters, which are set via environment variables (see Chrome webstore authentication).
verifyConditions parameters
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. This is used so that we can confirm that the credentials are working for the extension you are trying to publish.target: Valid options are:local: Skips Chrome store credentials verification
prepare
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.
prepare parameters
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.
The asset parameter is parsed with Lodash template. The following variables are available: branch, lastRelease, nextRelease and commits. Search on the plugins documentation to see the type of those objects.
Example: my-extension_v${nextRelease.version}_${branch.name}.zip will result in something like my-extension_v2.3.1_main.zip
publish
Uploads the generated zip file to the webstore and publishes a new release.
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.json with version 0.0.1 compressed 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 publish will fail with a 400 status code (Bad request).
publish parameters
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.asset: REQUIRED parameter. The zip file that will be published to the chrome webstore.target: Valid options are:default: The extension will be publicly available to everyone. This is the default option if left blank.draft: Uploads the extension to the webstore, but skips the publishing step.trustedTesters: Releases the extension as a private extension. Defaults todefault.local: Skips the publish step
The asset parameter is parsed with Lodash template. The following variables are available: branch, lastRelease, nextRelease and commits. Search on the plugins documentation to see the type of those objects.
Example: my-extension_v${nextRelease.version}_${branch.name}.zip will result in something like my-extension_v2.3.1_main.zip
Chrome webstore authentication
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.
Release configs
Use semantic-release-chrome as part of verifyConditions, prepare and publish.
A basic configuration file example is available below:
{
"plugins": [
[
"semantic-release-chrome",
{
"extensionId": "mppjhhbajcciljocgbadbhbgphjfdmhj",
"asset": "my-extension.zip"
}
],
[
"@semantic-release/github",
{
"assets": ["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.
LICENSE
MIT