mirror of
https://github.com/Azure/setup-helm.git
synced 2025-11-07 21:16:57 +00:00
refactor: building the helm download url
This commit is contained in:
parent
acb36743c6
commit
67a16f3bed
1 changed files with 14 additions and 22 deletions
36
src/run.ts
36
src/run.ts
|
|
@ -111,36 +111,28 @@ export function getHelmDownloadURL(baseURL: string, version: string): string {
|
||||||
const arch = os.arch()
|
const arch = os.arch()
|
||||||
const operatingSystem = os.type()
|
const operatingSystem = os.type()
|
||||||
|
|
||||||
|
let urlPath = ""
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case operatingSystem == LINUX && arch == ARM64:
|
case operatingSystem == LINUX && arch == ARM64:
|
||||||
return util.format(
|
urlPath = util.format(`/helm-%s-linux-arm64.zip`, version)
|
||||||
`${baseURL}/helm-%s-linux-arm64.zip`,
|
break
|
||||||
version
|
|
||||||
)
|
|
||||||
case operatingSystem == LINUX:
|
case operatingSystem == LINUX:
|
||||||
return util.format(
|
urlPath = util.format(`/helm-%s-linux-amd64.zip`, version)
|
||||||
`${baseURL}/helm-%s-linux-amd64.zip`,
|
break
|
||||||
version
|
|
||||||
)
|
|
||||||
|
|
||||||
case operatingSystem == MAC_OS && arch == ARM64:
|
case operatingSystem == MAC_OS && arch == ARM64:
|
||||||
return util.format(
|
urlPath = util.format(`/helm-%s-darwin-arm64.zip`, version)
|
||||||
`${baseURL}/helm-%s-darwin-arm64.zip`,
|
break
|
||||||
version
|
|
||||||
)
|
|
||||||
case operatingSystem == MAC_OS:
|
case operatingSystem == MAC_OS:
|
||||||
return util.format(
|
urlPath = util.format(`/helm-%s-darwin-amd64.zip`, version)
|
||||||
`${baseURL}/helm-%s-darwin-amd64.zip`,
|
break
|
||||||
version
|
|
||||||
)
|
|
||||||
|
|
||||||
case operatingSystem == WINDOWS:
|
case operatingSystem == WINDOWS:
|
||||||
default:
|
default:
|
||||||
return util.format(
|
urlPath = util.format(`/helm-%s-windows-amd64.zip`, version)
|
||||||
`${baseURL}/helm-%s-windows-amd64.zip`,
|
|
||||||
version
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const url = new URL(urlPath, baseURL)
|
||||||
|
return url.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function downloadHelm(baseURL: string, version: string): Promise<string> {
|
export async function downloadHelm(baseURL: string, version: string): Promise<string> {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue