From 93b4d599c06e2fe6efec6c68608658f45c7fd0fc Mon Sep 17 00:00:00 2001 From: develar Date: Tue, 24 Jan 2017 17:36:54 +0100 Subject: [PATCH] fix(deployment): another fix for "only first artifact is uploaded to GitHub" Close #1133 --- README.md | 2 +- packages/electron-builder/src/publish/gitHubPublisher.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c1a2a64e52a..451e5bee610 100755 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ For an app that will be shipped to production, you should sign your application. ``` Then you can run `npm run dist` (to package in a distributable format (e.g. dmg, windows installer, deb package)) or `npm run pack` (only generates the package directory without really packaging it. This is useful for testing purposes). - To ensure your native dependencies are always matched electron version, simply add `"postinstall": "install-app-deps"` to your `package.json`. [Do not use Yarn.](https://github.com/yarnpkg/yarn/issues/1749) + To ensure your native dependencies are always matched electron version, simply add `"postinstall": "install-app-deps"` to your `package.json`. 5. If you have native addons of your own that are part of the application (not as a dependency), add `"nodeGypRebuild": true` to the `build` section of your development `package.json`. :bulb: Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use [node-gyp-rebuild](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241488783) bin instead. diff --git a/packages/electron-builder/src/publish/gitHubPublisher.ts b/packages/electron-builder/src/publish/gitHubPublisher.ts index 72de396f7fd..64ce34710c9 100644 --- a/packages/electron-builder/src/publish/gitHubPublisher.ts +++ b/packages/electron-builder/src/publish/gitHubPublisher.ts @@ -30,11 +30,14 @@ interface Asset { export class GitHubPublisher extends Publisher { private tag: string private _releasePromise: Promise - private readonly httpExecutor: NodeHttpExecutor = new NodeHttpExecutor() + private readonly httpExecutor = new NodeHttpExecutor() private readonly token: string get releasePromise(): Promise { + if (this._releasePromise == null) { + this._releasePromise = this.token === "__test__" ? BluebirdPromise.resolve(null) : this.getOrCreateRelease() + } return this._releasePromise } @@ -56,10 +59,9 @@ export class GitHubPublisher extends Publisher { } this.tag = info.vPrefixedTagName === false ? version : `v${version}` - this._releasePromise = this.token === "__test__" ? BluebirdPromise.resolve(null) : this.init() } - private async init(): Promise { + private async getOrCreateRelease(): Promise { // we don't use "Get a release by tag name" because "tag name" means existing git tag, but we draft release and don't create git tag const releases = await githubRequest>(`/repos/${this.info.owner}/${this.info.repo}/releases`, this.token) for (const release of releases) {