/semantic-release-firefox-add-on

🦊 A Semantic Release plugin to sign Firefox Add Ons using web-ext

Primary LanguageJavaScriptApache License 2.0Apache-2.0

semantic-release-firefox-add-on

Semantic Release Firefox Add-on CICD npm version codecov All Contributors

Overview

Fork that fixes tophat#418

In this fork, the extensionId has to be defined in the manifest.json instead of this plugin.


Logo

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 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 command
  • FIREFOX_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

  • targetXpi: REQUIRED The filename of the XPI file to store in the artifacts directory.

  • sourceDir: The path of the source directory. Defaults to dist.

  • manifestPath: The location of the manifest file within the source directory. Defaults to manifest.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 to dist.

  • manifestPath: The location of the manifest file within the source directory. Defaults to manifest.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

  • targetXpi: REQUIRED The filename of the XPI file to store in the artifacts directory.

  • sourceDir: The path of the source directory. Defaults to dist.

  • channel: The release channel, options are unlisted or listed. An unlisted add on is not published to the store and is justed signed. Defaults to unlisted.

  • artifactsDir: The location to store the signed XPI file when it is returned from Mozilla. Defaults to ./artifacts.

Contribution

Follow the contributing guide.

Contributors


Daniel Basilio

💻 📖 🚧 🤔 👀

Emmanuel Ogbizi

💻 📖 🎨 🚇 ⚠️

iorate

💻

Marc Cataford

🚇

Add more contributors using all-contributors by adding comments in PRs:

@all-contributors please add <username> for <contribution type>