From b7b7b7013a09ef950bfd8d77a730d9cf37ce8713 Mon Sep 17 00:00:00 2001 From: Yuri Norwood <106889957+norwd@users.noreply.github.com> Date: Mon, 7 Nov 2022 09:24:59 +1300 Subject: [PATCH] Remove unix specific logging and determine .zip extension on windows Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> --- index.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 8ca5ddd..4a4080d 100644 --- a/index.js +++ b/index.js @@ -9,11 +9,17 @@ async function downloadRelease(octokit, os, org, repo, release, token) { repo: repo, release_id: release.id, }) - tarPostfix = `_${os}_amd64.tar.gz` + + postfix = `_${os}_amd64.tar.gz` + + if (os === "windows") { + postfix = `_${os}_amd64.zip` + } + for (let asset of releaseAssets.data) { console.log("Examining release asset " + asset.name + " at " + asset.browser_download_url + " ...") - if (asset.name.endsWith(tarPostfix)) { - console.log("Found Unix binary named " + asset.name + " at " + asset.browser_download_url + " , attempting download...") + if (asset.name.endsWith(postfix)) { + console.log("Found binary named " + asset.name + " at " + asset.browser_download_url + " , attempting download...") if (token) { execSync("curl -L -o /tmp/gotestfmt.tar.gz -H \"Authorization: Bearer " + token + "\" " + asset.browser_download_url) } else { @@ -33,7 +39,8 @@ async function downloadRelease(octokit, os, org, repo, release, token) { return } } - throw `No release asset matched postfix '${tarPostfix}'.` + + throw `No release asset matched postfix '${postfix}'.` } async function downloadGofmt(octokit, version, versionPrefix, os, org, repo, token) {