mirror of
https://github.com/opentofu/setup-opentofu.git
synced 2025-12-31 15:02:19 +00:00
Fix latest fetching prerelease versions. (#29)
* Fix fetching latest version to not fetch prerelease. Signed-off-by: Kuba Martin <kubam@spacelift.io> * Add tests. Signed-off-by: Jakub Martin <kubam@spacelift.io> --------- Signed-off-by: Kuba Martin <kubam@spacelift.io> Signed-off-by: Jakub Martin <kubam@spacelift.io>
This commit is contained in:
parent
d00c6817f1
commit
ae80d4ecaa
3 changed files with 187 additions and 6 deletions
2
dist/index.js
vendored
2
dist/index.js
vendored
|
|
@ -61,7 +61,7 @@ async function fetchReleases (githubToken) {
|
|||
const semver = __nccwpck_require__(1383);
|
||||
|
||||
async function findLatestVersion (versions) {
|
||||
return versions.sort((a, b) => semver.rcompare(a, b))[0];
|
||||
return versions.filter((v) => semver.prerelease(v) === null).sort((a, b) => semver.rcompare(a, b))[0];
|
||||
}
|
||||
|
||||
async function findLatestVersionInRange (versions, range) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue