From 8849ac0c0ca971fe5a7b146015177d73c5f812c2 Mon Sep 17 00:00:00 2001 From: calebboyd Date: Thu, 31 Jan 2019 19:56:36 -0600 Subject: [PATCH] chore: don't try to upload an existing asset --- tasks/asset-compile.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasks/asset-compile.ts b/tasks/asset-compile.ts index 15b2ea9..61feb9f 100644 --- a/tasks/asset-compile.ts +++ b/tasks/asset-compile.ts @@ -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),