mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-27 03:39:54 +00:00
refactor: Make get_nextflow_release work using NextflowRelease objects
This commit is contained in:
parent
0b5ecde5fa
commit
5d8e8fd6f5
1 changed files with 8 additions and 2 deletions
|
@ -34,11 +34,17 @@ function tag_filter(version: string): (NextflowRelease) => Boolean {
|
|||
return filter
|
||||
}
|
||||
|
||||
const matching_releases = all_releases.filter(filter)
|
||||
export async function get_nextflow_release(
|
||||
version: string,
|
||||
releases: Array<NextflowRelease>
|
||||
): Promise<NextflowRelease> {
|
||||
// Filter the releases
|
||||
const filter = tag_filter(version)
|
||||
const matching_releases = releases.filter(filter)
|
||||
|
||||
matching_releases.sort((x, y) => {
|
||||
// HACK IDK why the value flip is necessary with the return
|
||||
return semver.compare(x["tag_name"], y["tag_name"], true) * -1
|
||||
return semver.compare(x.versionNumber, y.versionNumber, true) * -1
|
||||
})
|
||||
|
||||
return matching_releases[0]
|
||||
|
|
Loading…
Reference in a new issue