Skip to content

Commit

Permalink
Allow specifying release channel when signing
Browse files Browse the repository at this point in the history
  • Loading branch information
welwood08 committed Feb 10, 2018
1 parent f3769db commit 941eb42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/amo-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ export class Client {
* - `xpiPath` Path to xpi file.
* - `guid` Optional add-on GUID, aka the ID in install.rdf.
* - `version` add-on version string.
* - `channel` release channel (listed, unlisted).
* @return {Promise} signingResult with keys:
* - success: boolean
* - downloadedFiles: Array of file objects
* - id: string identifier for the signed add-on
*/
sign({guid, version, xpiPath}) {
sign({channel=null, guid, version, xpiPath}) {

const formData = {
upload: this._fs.createReadStream(xpiPath),
Expand All @@ -93,6 +94,9 @@ export class Client {
// PUT to a specific URL for this add-on + version.
addonUrl += encodeURIComponent(guid) +
"/versions/" + encodeURIComponent(version) + "/";
if (channel) {
formData.channel = channel;
}
} else {
// POST to a generic URL to create a new add-on.
this.debug("Signing add-on without an ID");
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export default function signAddon(
id,
// The add-on version number for AMO.
version,
// The release channel on AMO.
// Missing or invalid translates to most recently used channel.
channel=null,
// Your API key (JWT issuer) from AMO Devhub.
apiKey,
// Your API secret (JWT secret) from AMO Devhub.
Expand Down Expand Up @@ -87,6 +90,7 @@ export default function signAddon(
xpiPath: xpiPath,
guid: id,
version: version,
channel,
});

});
Expand Down

0 comments on commit 941eb42

Please sign in to comment.