2023-12-23 17:21:56 +00:00
|
|
|
/**
|
|
|
|
* Houses the pertinent data that GitHub exposes for each Nextflow release
|
|
|
|
*/
|
|
|
|
export type NextflowRelease = {
|
2024-02-02 17:22:07 +00:00
|
|
|
version: string
|
2023-12-23 17:21:56 +00:00
|
|
|
isEdge: boolean
|
2024-02-02 17:23:51 +00:00
|
|
|
downloadUrl: string
|
2024-02-02 17:26:09 +00:00
|
|
|
downloadUrlAll: string
|
2024-02-02 15:39:05 +00:00
|
|
|
published_at?: string
|
2023-12-23 17:21:56 +00:00
|
|
|
}
|
2023-12-23 17:27:00 +00:00
|
|
|
|
2023-12-23 17:28:20 +00:00
|
|
|
/**
|
|
|
|
* Converts the raw OctoKit data into a structured NextflowRelease
|
|
|
|
* @param data A "release" data struct from OctoKit
|
|
|
|
* @returns `data` converted into a `NextflowRelease`
|
|
|
|
*/
|
|
|
|
export function nextflow_release(data: object): NextflowRelease {
|
|
|
|
const nf_release: NextflowRelease = {
|
2024-02-02 17:22:07 +00:00
|
|
|
version: data["tag_name"],
|
2023-12-23 17:28:20 +00:00
|
|
|
isEdge: data["prerelease"],
|
2024-02-02 17:23:51 +00:00
|
|
|
downloadUrl: nextflow_bin_url(data, false),
|
2024-02-02 17:26:09 +00:00
|
|
|
downloadUrlAll: nextflow_bin_url(data, true)
|
2023-12-23 17:28:20 +00:00
|
|
|
}
|
|
|
|
return nf_release
|
|
|
|
}
|
|
|
|
|
2023-12-23 17:27:00 +00:00
|
|
|
/**
|
|
|
|
* 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
|
2024-01-06 16:22:02 +00:00
|
|
|
if (dl_asset) {
|
|
|
|
return dl_asset.browser_download_url
|
|
|
|
} else {
|
|
|
|
// Old pre-release versions of Nextflow didn't have an "all" variant. To
|
|
|
|
// avoid downstream errors, substitute the regular url here.
|
|
|
|
return regular_asset.browser_download_url
|
|
|
|
}
|
2023-12-23 17:27:00 +00:00
|
|
|
}
|