From 7e9131d82bb39aa6c1f1f07a6a49b28a2848985c Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 30 Jan 2018 17:35:16 -0700 Subject: [PATCH] Allow multiple releases to run at once Find draft release by draft flag and tag name --- script/prepare-release.js | 3 ++- script/release.js | 11 ++++------- script/upload.py | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/script/prepare-release.js b/script/prepare-release.js index ccc9057693fe..173ad3e2f2ba 100755 --- a/script/prepare-release.js +++ b/script/prepare-release.js @@ -119,7 +119,8 @@ async function createRelease (branchToTarget, isBeta) { .catch(err => { console.log('$fail} Could not get releases. Error was', err) }) - let drafts = releases.data.filter(release => release.draft) + let drafts = releases.data.filter(release => release.draft && + release.tag_name === newVersion) if (drafts.length > 0) { console.log(`${fail} Aborting because draft release for ${drafts[0].tag_name} already exists.`) diff --git a/script/release.js b/script/release.js index 50ab0aff0897..bed6edeb698e 100755 --- a/script/release.js +++ b/script/release.js @@ -31,21 +31,18 @@ async function getDraftRelease (version, skipValidation) { let drafts let versionToCheck if (version) { - drafts = releaseInfo.data - .filter(release => release.tag_name === version) versionToCheck = version } else { - drafts = releaseInfo.data - .filter(release => release.draft) versionToCheck = pkgVersion } - + drafts = releaseInfo.data + .filter(release => release.tag_name === versionToCheck && + release.draft === true) const draft = drafts[0] if (!skipValidation) { failureCount = 0 check(drafts.length === 1, 'one draft exists', true) - check(draft.tag_name === versionToCheck, `draft release version matches local package.json (${versionToCheck})`) - if (versionToCheck.indexOf('beta')) { + if (versionToCheck.indexOf('beta') > -1) { check(draft.prerelease, 'draft is a prerelease') } check(draft.body.length > 50 && !draft.body.includes('(placeholder)'), 'draft has release notes') diff --git a/script/upload.py b/script/upload.py index 2be84be82d78..4da630433812 100755 --- a/script/upload.py +++ b/script/upload.py @@ -179,7 +179,7 @@ def get_text_with_editor(name): def create_or_get_release_draft(github, releases, tag, tag_exists): # Search for existing draft. for release in releases: - if release['draft']: + if release['draft'] and release['tag_name'] == tag: return release if tag_exists: