1.3.0 • Published 9 months ago

semantic-release-amo v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

semantic-release-amo

A semantic-release plugin to publish Firefox add-ons to AMO (addons.mozilla.org).

Motivation

semantic-release-firefox-add-on is a great plugin to publish Firefox add-ons to AMO. However, it does not support submitting source code.

This plugin makes it possible to submit source code by using API V5.

Usage

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "semantic-release-amo",
      {
        "addonId": "my-addon-id",
        "addonDirPath": "dist",
        "approvalNotes": "To build this add-on, please run `yarn && yarn build`",
        "submitSource": true
      }
    ]
  ]
}

Steps

StepDescription
verifyConditionsVerify the environment variables and the options.
prepareUpdate manifest.json and archive the add-on.
publishPublish the add-on to AMO.

Environment variables

VariableDescription
AMO_API_KEYREQUIRED The API key to publish the add-on to AMO.
AMO_API_SECRETREQUIRED The API secret to publish the add-on to AMO.
AMO_BASE_URLThe base URL of AMO. Defaults to https://addons.mozilla.org/.

Options

OptionDescription
addonIdREQUIRED The id of the add-on. Can be either a slug or a GUID.
addonDirPathREQUIRED The path of the directory containing the add-on.
addonZipPathThe path of the zip file to archive the add-on. Defaults to "./semantic-release-amo/${nextRelease.version}.zip".
channelThe channel to publish the add-on. Can be either "listed" or "unlisted". Defaults to "listed".
approvalNotesThe notes for the Mozilla reviewers.
compatibilityThe applications that the add-on is compatible with. Can be an array of "firefox" or "android". Defaults to ["firefox"].
submitReleaseNotesWhether to submit the release notes typically generated by @semantic-release/release-notes-generator. Defaults to false.
submitSourceWhether to submit the source code archived by git archive. Defaults to false.

Exported function

updateAddon

import { updateAddon } from 'semantic-release-amo/update-addon';

await updateAddon({
  apiKey: '...',
  apiSecret: '...',
  baseURL: 'https://addons.mozilla.org/', // optional, defaults to 'https://addons.mozilla.org/'
  addonId: '...',
  addonZipPath: await generateAddonZip(),
  channel: 'listed', // optional, defaults to 'listed'
  approvalNotes: '...', // optional
  compatibility: ['firefox'], // optional, defaults to ['firefox']
  releaseNotes: '...', // optional
  sourceZipPath: await generateSourceZip(), // optional
  logger: console, // optional, defaults to console
});

Author

iorate (Twitter)

License

semantic-release-amo is licensed under MIT License.