diff --git a/docs/extend.md b/docs/extend.md index d8bc64f562..2250c1785a 100644 --- a/docs/extend.md +++ b/docs/extend.md @@ -178,7 +178,7 @@ The options object has the following structure. | Key | Value | |-----|-------| | `dir` | The base directory of the apps source code | -| `artifacts` | An array of artifact objects, see the [MakeResult](https://docs.electronforge.io/typedef/index.html#static-typedef-MakeResult) object definition for details | +| `makeResults` | An array of MakeResult objects, see the [MakeResult](https://docs.electronforge.io/typedef/index.html#static-typedef-MakeResult) object definition for details | | `packageJSON` | The packageJSON of the app | | `config` | The config that is dedicated for this publisher | | `forgeConfig` | The raw forgeConfig this app is using, you shouldn't really have to use this | diff --git a/packages/api/core/src/api/publish.js b/packages/api/core/src/api/publish.js index 53726e31be..daceb88687 100644 --- a/packages/api/core/src/api/publish.js +++ b/packages/api/core/src/api/publish.js @@ -121,11 +121,6 @@ const publish = async (providedOptions = {}) => { throw 'Failed to locate publishable Electron application'; } - const artifacts = makeResults.reduce((accum, makeResult) => { - accum.push(...makeResult.artifacts); - return accum; - }, []); - const testPlatform = makeOptions.platform || process.platform; if (publishTargets === null) { publishTargets = (forgeConfig.publishers || []) @@ -152,7 +147,7 @@ const publish = async (providedOptions = {}) => { await publisher.publish({ dir, - artifacts, + makeResults, packageJSON, config: publishTarget.config || {}, forgeConfig, diff --git a/packages/publisher/base/src/Publisher.js b/packages/publisher/base/src/Publisher.js index d1642750e8..cbd4306691 100644 --- a/packages/publisher/base/src/Publisher.js +++ b/packages/publisher/base/src/Publisher.js @@ -23,7 +23,7 @@ export default class Publisher { */ async publish({ dir, // The base directory of the apps source code - artifacts, // An array of artifact objects, see the MakeResult object definition for details + makeResults, // An array of MakeResult objects, see the MakeResult object definition for details packageJSON, // The packageJSON of the app config, // The config that is dedicated for this publisher forgeConfig, // The raw forgeConfig this app is using, you shouldn't really have to use this diff --git a/packages/publisher/electron-release-server/src/PublisherERS.js b/packages/publisher/electron-release-server/src/PublisherERS.js index 06df04355b..e5b7f8eb2f 100644 --- a/packages/publisher/electron-release-server/src/PublisherERS.js +++ b/packages/publisher/electron-release-server/src/PublisherERS.js @@ -27,7 +27,12 @@ export default class PublisherERS extends PublisherBase { super('electron-release-server'); } - async publish({ artifacts, packageJSON, config, platform, arch }) { + async publish({ makeResults, packageJSON, config, platform, arch }) { + const artifacts = makeResults.reduce((flat, makeResult) => { + flat.push(...makeResult.artifacts); + return flat; + }, []); + if (!(config.baseUrl && config.username && config.password)) { throw 'In order to publish to ERS you must set the "electronReleaseServer.baseUrl", "electronReleaseServer.username" and "electronReleaseServer.password" properties in your forge config. See the docs for more info'; // eslint-disable-line } diff --git a/packages/publisher/github/src/PublisherGithub.js b/packages/publisher/github/src/PublisherGithub.js index 80515c9f91..b6dee8589b 100644 --- a/packages/publisher/github/src/PublisherGithub.js +++ b/packages/publisher/github/src/PublisherGithub.js @@ -12,7 +12,12 @@ export default class PublisherGithub extends PublisherBase { super('github'); } - async publish({ artifacts, packageJSON, config, tag }) { + async publish({ makeResults, packageJSON, config, tag }) { + const artifacts = makeResults.reduce((flat, makeResult) => { + flat.push(...makeResult.artifacts); + return flat; + }, []); + if (!(config.repository && typeof config.repository === 'object' && config.repository.owner && config.repository.name)) { throw 'In order to publish to github you must set the "github_repository.owner" and "github_repository.name" properties in your forge config. See the docs for more info'; // eslint-disable-line diff --git a/packages/publisher/s3/src/PublisherS3.js b/packages/publisher/s3/src/PublisherS3.js index c318cd11b5..3e2a718f70 100644 --- a/packages/publisher/s3/src/PublisherS3.js +++ b/packages/publisher/s3/src/PublisherS3.js @@ -19,7 +19,12 @@ export default class PublisherS3 extends PublisherBase { super('s3'); } - async publish({ artifacts, packageJSON, config, tag }) { + async publish({ makeResults, packageJSON, config, tag }) { + const artifacts = makeResults.reduce((flat, makeResult) => { + flat.push(...makeResult.artifacts); + return flat; + }, []); + const s3Client = new AWS.S3({ accessKeyId: config.accessKeyId, secretAccessKey: config.secretAccessKey, diff --git a/packages/publisher/snapcraft/src/PublisherSnapcraft.js b/packages/publisher/snapcraft/src/PublisherSnapcraft.js index 89240623b8..303a3920e8 100644 --- a/packages/publisher/snapcraft/src/PublisherSnapcraft.js +++ b/packages/publisher/snapcraft/src/PublisherSnapcraft.js @@ -10,7 +10,12 @@ export default class PublisherSnapcraft extends PublisherBase { super('snapcraft'); } - async publish({ dir, artifacts, config }) { + async publish({ dir, makeResults, config }) { + const artifacts = makeResults.reduce((flat, makeResult) => { + flat.push(...makeResult.artifacts); + return flat; + }, []); + const snapArtifacts = artifacts.filter(artifact => artifact.endsWith('.snap')); if (snapArtifacts.length === 0) {