chore: don't try to upload an existing asset

This commit is contained in:
calebboyd
2019-01-31 19:56:36 -06:00
parent 8ad6641278
commit 8849ac0c0c
+6 -1
View File
@@ -2,7 +2,7 @@ import * as nexe from '../lib/nexe'
import { getUnBuiltReleases, getLatestGitRelease } from '../lib/releases'
import * as ci from './ci'
import { runDockerBuild } from './docker'
import { getTarget } from '../lib/target'
import { getTarget, targetsEqual } from '../lib/target'
import { pathExistsAsync, readFileAsync, execFileAsync } from '../lib/util'
import got = require('got')
@@ -70,6 +70,11 @@ async function build() {
if (await pathExistsAsync(output)) {
await assertNexeBinary(output)
const gitRelease = await getLatestGitRelease({ headers })
const unbuiltReleases = await getUnBuiltReleases({ headers })
if (!unbuiltReleases.some(x => targetsEqual(x, target))) {
console.log(`${target} already uploaded.`)
return
}
await got(gitRelease.upload_url.split('{')[0], {
query: { name: target.toString() },
body: await readFileAsync(output),