Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

semantic-release-chrome

Set of semantic-release plugins for publishing a Chrome extension release


Build Status version downloads MIT License

PRs Welcome Code of Conduct

Watch on GitHub Star on GitHub Tweet

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-chrome

Description

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).

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 to dist.

  • manifestPath: The path of the manifest.json file inside the dist folder. Defaults to <distFolder parameter>/manifest.json.

publish

Uploads the generated zip file to the webstore and publishes a new release.

publish parameters

  • extensionId: REQUIRED parameter. The extension id from 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 the extension id. You can also take this ID on the developers dashboard, under the name Item ID located inside the More info dialog.

    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 publishing will fail with a 400 status code (Bad request).

  • asset: REQUIRED parameter. The zip file that will be published to the chrome webstore.

  • target: can be default or trustedTesters. When released using the first, the extension will be publicly available to everyone. When trustedTesters is used, it will be released as a private extension. Defaults to default.

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:

{
  "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.

LICENSE

MIT