semantic-release-firefox-add-on
v0.2.8
Published
A Semantic Release plugin to sign packages through the Firefox AddOn store
Downloads
799
Readme
semantic-release-firefox-add-on
Overview
This package provides a set of semantic-release
plugins for you to easily publish Firefox add ons automatically. Mozilla requires that even self-distributed packages are signed through the add on store. Given a built package, it will write the correct version number into manifest.json
and upload the dist folder to the add on store. The package will be validated by Mozilla, and if valid, a signed distribution will be returned and downloaded into the artifacts folder.
Motivation
We were working on a dev tooling extension internally and wanted to release it through the Chrome web store and Mozilla Add On store. The semantic-release-chrome
extension worked wonderfully, but we kept struggling to find a semantic-release
plugin for FireFox that worked the way we wanted. After finding that web-ext
had a Node api, we just built our own plugins using web-ext
to accomplish the goal.
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-firefox-add-on
Mozilla Add On authentication
You will need to get two parameters from the Add On store: an API Key
, and a Secret Key
. 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.
web-ext takes care of creation of the JWT, the only items needed are the API Key
and Secret Key
.
Usage
This package export the following plugins:
verifyConditions
Verify the following:
- That environment variables are set for Add On store authentication
- That an extensionId was specified in the configuration
- That the source directory is built and that we can locate the manifest.json file within the source directory
Environment variables
FIREFOX_API_KEY
: REQUIRED Mozilla add-on server api key used in webext sign commandFIREFOX_SECRET_KEY
: REQUIRED Mozilla add-on server api secret used in webext signing
For more information on the source of these values, see Mozilla Add On authentication
verifyConditions
parameters
extensionId
: REQUIRED The extension id of the extension from the Mozilla Add On store. If this is not specified then a new extension will be created each time the release is run. In order to avoid issues arising due to this, the extension must be created in the Add On store first and the extension Id put into the semantic release configuration.targetXpi
: REQUIRED The filename of the XPI file to store in the artifacts directory.sourceDir
: The path of the source directory. Defaults todist
.manifestPath
: The location of the manifest file within the source directory. Defaults tomanifest.json
.
prepare
Writes the correct version to the manifest.json
.
This plugin requires some parameters to be set, so be sure to check below and fill them accordingly.
prepare
parameters
sourceDir
: The path of the source directory. Defaults todist
.manifestPath
: The location of the manifest file within the source directory. Defaults tomanifest.json
.
publish
Creates an unsigned XPI file out of the source directory and uploads it to the Mozilla Add On, using the web-ext sign command. The output from the sign command will be passed through to the console. If the package is validated and signed, it will download the signed XPI file and store it in the artifacts directory under the specified file name. If the package is validated but not signed (including the case where manual review is required), it will store the unsigned XPI file in the artifacts directory.
publish
parameters
extensionId
: REQUIRED The extension id of the extension from the Mozilla Add On store.targetXpi
: REQUIRED The filename of the XPI file to store in the artifacts directory.sourceDir
: The path of the source directory. Defaults todist
.channel
: The release channel, options areunlisted
orlisted
. An unlisted add on is not published to the store and is justed signed. Defaults tounlisted
.artifactsDir
: The location to store the signed XPI file when it is returned from Mozilla. Defaults to./artifacts
.
Contribution
Follow the contributing guide.
Contributors
Add more contributors using all-contributors by adding comments in PRs:
@all-contributors please add <username> for <contribution type>