From 1b4f093f6d43d634cb0a67fc9941d7b9601f841a Mon Sep 17 00:00:00 2001 From: Pieter Joost van de Sande Date: Tue, 19 Jan 2021 10:32:31 +0100 Subject: [PATCH] fix: fix support for go beta releases closes #96 --- .github/workflows/versions.yml | 4 ++-- dist/index.js | 20 +++++++++++++++----- src/installer.ts | 16 +++++++++++----- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml index 6b6d5f956..f10e9cac6 100644 --- a/.github/workflows/versions.yml +++ b/.github/workflows/versions.yml @@ -39,8 +39,8 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - go: [1.12.16, 1.13.11, 1.14.3] + os: [ubuntu-latest] + go: [1.16-beta1, 1.16] steps: - name: Checkout uses: actions/checkout@v2 diff --git a/dist/index.js b/dist/index.js index 8c745f3f7..a2b7ac400 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5150,9 +5150,17 @@ function findMatch(versionSpec, stable) { if (parts.length == 2) { version = version + '.0'; } - core.debug(`check ${version} satisfies ${versionSpec}`); - if (semver.satisfies(version, versionSpec) && - (!stable || candidate.stable === stable)) { + + let satisfied = semver.satisfies(version, versionSpec); + + if(!satisfied) { + core.debug(`${version} doesn't satisfy ${versionSpec}`); + continue; + } + + core.debug(`${version} does satisfy ${versionSpec}`); + + if (!stable || candidate.stable === stable) { goFile = candidate.files.find(file => { core.debug(`${file.arch}===${archFilter} && ${file.os}===${platFilter}`); return file.arch === archFilter && file.os === platFilter; @@ -5161,7 +5169,9 @@ function findMatch(versionSpec, stable) { core.debug(`matched ${candidate.version}`); match = candidate; break; - } + } else { + core.debug(`version statisfied ${candidateversion}, but coulnd't find supported platform and/or architecture`); + } } } if (match && goFile) { @@ -5451,4 +5461,4 @@ exports.exec = exec; /***/ }) -/******/ }); \ No newline at end of file +/******/ }); diff --git a/src/installer.ts b/src/installer.ts index 0e0d5d399..42b9e98fe 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -210,11 +210,17 @@ export async function findMatch( version = version + '.0'; } - core.debug(`check ${version} satisfies ${versionSpec}`); - if ( - semver.satisfies(version, versionSpec) && - (!stable || candidate.stable === stable) - ) { + let satisfied = semver.satisfies(version, versionSpec); + + if(!satisfied) { + core.debug(`${version} doesn't satisfy ${versionSpec}`); + continue; + } + + core.debug(`${version} does satisfy ${versionSpec}`); + + if (!stable || candidate.stable === stable) + { goFile = candidate.files.find(file => { core.debug( `${file.arch}===${archFilter} && ${file.os}===${platFilter}`