mirror of
https://github.com/opentofu/setup-opentofu.git
synced 2026-11-30 03:44:21 +01: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:
1 parent
d00c6817f1
commit
ae80d4ecaa
3 files changed
+187
-6
No files matched your search
+1
-1
@@ -55,7 +55,7 @@ async function fetchReleases (githubToken) {
|
||||
const semver = require('semver');
|
||||
|
||||
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) {
|
||||
|
||||
Reference in new issue
Block a user