mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
[Windows] Update Kotlin install (#4645)
This commit is contained in:
@@ -559,3 +559,30 @@ function Invoke-SBWithRetry {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-GitHubPackageDownloadUrl {
|
||||
param (
|
||||
[string]$RepoOwner,
|
||||
[string]$RepoName,
|
||||
[string]$BinaryName,
|
||||
[string]$Version,
|
||||
[string]$UrlFilter,
|
||||
[boolean]$IsPrerelease = $false,
|
||||
[int]$SearchInCount = 100
|
||||
)
|
||||
|
||||
if ($Version -eq "latest") {
|
||||
$Version = "*"
|
||||
}
|
||||
$json = Invoke-RestMethod -Uri "https://api.github.com/repos/${RepoOwner}/${RepoName}/releases?per_page=${SearchInCount}"
|
||||
$versionToDownload = ($json.Where{ $_.prerelease -eq $IsPrerelease }.tag_name |
|
||||
Select-String -Pattern "\d+.\d+.\d+").Matches.Value |
|
||||
Where-Object {$_ -Like "${Version}.*" -or $_ -eq ${Version}} |
|
||||
Sort-Object {[version]$_} |
|
||||
Select-Object -Last 1
|
||||
|
||||
$UrlFilter = $UrlFilter -replace "{BinaryName}",$BinaryName -replace "{Version}",$versionToDownload
|
||||
$downloadUrl = $json.assets.browser_download_url -like $UrlFilter
|
||||
|
||||
return $downloadUrl
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user