Skip to content

Commit

Permalink
fix: fix support for go beta releases
Browse files Browse the repository at this point in the history
closes actions#96
  • Loading branch information
pjvds committed Jan 19, 2021
1 parent 3b4dc6c commit 1b4f093
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 15 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -5451,4 +5461,4 @@ exports.exec = exec;

/***/ })

/******/ });
/******/ });
16 changes: 11 additions & 5 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
Expand Down

0 comments on commit 1b4f093

Please sign in to comment.