Allow multiple releases to run at once

Find draft release by draft flag and tag name
This commit is contained in:
John Kleinschmidt 2018-01-30 17:35:16 -07:00
parent 67196bdd3e
commit 7e9131d82b
3 changed files with 7 additions and 9 deletions

View file

@ -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.`)

View file

@ -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')

View file

@ -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: