From 3987b069afc00515b98f09999375bd8ba01baeed Mon Sep 17 00:00:00 2001 From: develar Date: Wed, 1 Feb 2017 17:03:06 +0100 Subject: [PATCH] fix(deployment): Artifacts still get pushed to github releases marked as published Close #1197 --- packages/electron-builder/src/publish/gitHubPublisher.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/electron-builder/src/publish/gitHubPublisher.ts b/packages/electron-builder/src/publish/gitHubPublisher.ts index d65fd1188f4..e5eecc2b260 100644 --- a/packages/electron-builder/src/publish/gitHubPublisher.ts +++ b/packages/electron-builder/src/publish/gitHubPublisher.ts @@ -66,10 +66,17 @@ export class GitHubPublisher extends Publisher { const releases = await this.githubRequest>(`/repos/${this.info.owner}/${this.info.repo}/releases`, this.token) for (const release of releases) { if (release.tag_name === this.tag || release.tag_name === this.version) { - if (release.draft || release.prerelease) { + if (release.draft) { return release } + // https://github.com/electron-userland/electron-builder/issues/1197 + // https://electron-builder.slack.com/archives/general/p1485961449000202 + if (this.options.draft == null || this.options.draft) { + warn(`Release with tag ${this.tag} already exists`) + return null + } + // https://github.com/electron-userland/electron-builder/issues/1133 // if release created < 2 hours — allow to upload const publishedAt = release.published_at == null ? null : new Date(release.published_at)