mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-24 02:19:55 +00:00
Thomas A. Christensen II
a97128956e
Nextflow binary URLs should be stored in the new NextflowRelease object, so it should essentially be private for the NextflowRelease type. Move the function to that file to signify that (but retain export for testing purposes).
29 lines
880 B
TypeScript
29 lines
880 B
TypeScript
/**
|
|
* Houses the pertinent data that GitHub exposes for each Nextflow release
|
|
*/
|
|
export type NextflowRelease = {
|
|
versionNumber: string
|
|
isEdge: boolean
|
|
binaryURL: string
|
|
allBinaryURL: string
|
|
}
|
|
|
|
/**
|
|
* Gets the download URL of a Nextflow binary
|
|
* @param release A "release" data struct from OctoKit
|
|
* @param get_all Whether to return the url for the "all" variant of Nextflow
|
|
* @returns The URL of the Nextflow binary
|
|
*/
|
|
export function nextflow_bin_url(release: object, get_all: boolean): string {
|
|
const release_assets = release["assets"]
|
|
const all_asset = release_assets.filter((a: object) => {
|
|
return a["browser_download_url"].endsWith("-all")
|
|
})[0]
|
|
const regular_asset = release_assets.filter((a: object) => {
|
|
return a["name"] === "nextflow"
|
|
})[0]
|
|
|
|
const dl_asset = get_all ? all_asset : regular_asset
|
|
|
|
return dl_asset.browser_download_url
|
|
}
|