Skip to content

Commit

Permalink
bug: Fix the powershell install (#1312)
Browse files Browse the repository at this point in the history
- picks binaries from github releases

Signed-off-by: Anoop Gopalakrishnan <[email protected]>
  • Loading branch information
anoop2811 authored Mar 12, 2024
1 parent 610d916 commit 0dff498
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions static/script/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ $VelaCliBuildNameLegacy = "vela"
$VelaCliBuildName = "vela.exe"
$VelaCliFileName = "vela.exe"
$VelaCliFilePath = "${VelaRoot}\${VelaCliFileName}"
$RemoteURL = "https://static.kubevela.net/binary/vela"
$VersionCheckURL = "https://api.github.com/repos/kubevela/kubevela"
$RemoteURL = "https://github.com/kubevela/kubevela/releases/download"

if ((Get-ExecutionPolicy) -gt 'RemoteSigned' -or (Get-ExecutionPolicy) -eq 'ByPass') {
Write-Output "PowerShell requires an execution policy of 'RemoteSigned'."
Expand Down Expand Up @@ -49,13 +50,20 @@ if (!(Test-Path $VelaRoot -PathType Container)) {
$os_arch = "windows-amd64"
$vela_cli_filename = "vela"
if (!$Version) {
$Version = Invoke-RestMethod -Headers $githubHeader -Uri "${RemoteURL}/latest_version" -Method Get
$Version = $Version.Trim()
}
if (!$Version.startswith("v")) {
$Version = "v" + $Version
$response = Invoke-RestMethod -Headers $githubHeader -Uri "${VersionCheckURL}/releases/latest" -Method Get
$latestRelease = $response.tag_name
if (!$latestRelease) {
Write-Error "Error: Unable to retrieve the latest version."
exit 1
}

if (!$latestRelease.StartsWith("v")) {
$latestRelease = "v" + $latestRelease
}
$Version = $latestRelease
}


$assetName = "${vela_cli_filename}-${Version}-${os_arch}.zip"
$zipFileUrl = "${RemoteURL}/${Version}/${assetName}"

Expand Down

0 comments on commit 0dff498

Please sign in to comment.