Update gh windows install script to use official release assets

This commit is contained in:
Sam
2020-10-08 13:16:57 +02:00
committed by Sam Coe
parent 6d9bcfbbbb
commit 6a1710a597

View File

@@ -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"
Invoke-PesterTests -TestFile "CLI.Tools" -TestName "GitHub CLI"