From 6a1710a597d7e0e7f8c86f0cccd163316579694f Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 8 Oct 2020 13:16:57 +0200 Subject: [PATCH] Update gh windows install script to use official release assets --- images/win/scripts/Installers/Install-GitHub-CLI.ps1 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-GitHub-CLI.ps1 b/images/win/scripts/Installers/Install-GitHub-CLI.ps1 index 7891991d4..b708508ad 100644 --- a/images/win/scripts/Installers/Install-GitHub-CLI.ps1 +++ b/images/win/scripts/Installers/Install-GitHub-CLI.ps1 @@ -3,8 +3,15 @@ ## Desc: Install GitHub CLI ################################################################################ -Choco-Install -PackageName gh +Write-Host "Get the latest gh version..." +$GhReleasesJson = Invoke-RestMethod "https://api.github.com/repos/cli/cli/releases/latest" +$WindowsMsiAssetNamePattern = "windows_amd64.msi" +$WindowsMsiAsset = $GhReleasesJson.assets | Where-Object { $_.name.EndsWith($WindowsMsiAssetNamePattern) } | Select-Object -First 1 +$Name = $WindowsMsiAsset.name +$DownloadUrl = $WindowsMsiAsset.browser_download_url + +Install-Binary -Url $DownloadUrl -Name $Name Add-MachinePathItem "C:\Program Files (x86)\GitHub CLI" -Invoke-PesterTests -TestFile "CLI.Tools" -TestName "GitHub CLI" \ No newline at end of file +Invoke-PesterTests -TestFile "CLI.Tools" -TestName "GitHub CLI"