[Windows] Update functions that get urls and hashes from Github (#8917)

* [Windows] Update function to get hash from github

* Remove redundant function and add documentation

* Fix aws-sam-cli url
This commit is contained in:
Vasilii Polikarpov
2023-11-30 17:12:17 +01:00
committed by GitHub
parent eb0e4ff100
commit d86c4900fa
5 changed files with 281 additions and 72 deletions

View File

@@ -5,12 +5,17 @@
################################################################################
# Install the latest version of Git for Windows
$repoURL = "https://api.github.com/repos/git-for-windows/git/releases/latest"
$gitReleases = Invoke-RestMethod $repoURL
$downloadUrl = $gitReleases.assets.browser_download_url -match "Git-.+-64-bit.exe" | Select-Object -First 1
$installerFile = Split-Path $downloadUrl -Leaf
$externalHash = Get-HashFromGitHubReleaseBody -Url $RepoURL -FileName $installerFile
$downloadUrl = Resolve-GithubReleaseAssetUrl `
-Repo "git-for-windows/git" `
-Version "latest" `
-UrlMatchPattern "Git-*-64-bit.exe"
$externalHash = Get-GithubReleaseAssetHash `
-Repo "git-for-windows/git" `
-Version "latest" `
-FileName (Split-Path $downloadUrl -Leaf) `
-HashType "SHA256"
Install-Binary `
-Url $downloadUrl `