mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-10 03:13:23 +00:00
Notifications for Node and Go versions not on image (#44)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
function Search-ToolsVersionsNotOnImage {
|
||||
param (
|
||||
[string]$ToolName,
|
||||
[string]$ReleasesUrl,
|
||||
[string]$FilterParameter,
|
||||
[string]$FilterArch
|
||||
)
|
||||
|
||||
$stableReleases = (Invoke-RestMethod $ReleasesUrl) | Where-Object stable -eq $true
|
||||
$stableReleaseVersions = $stableReleases | ForEach-Object {
|
||||
if ($ToolName -eq "Node") {
|
||||
$_.$FilterParameter.split(".")[0] + ".0"
|
||||
} else {
|
||||
$_.$FilterParameter.split(".")[0,1] -join"."
|
||||
}
|
||||
} | Select-Object -Unique
|
||||
$toolsetUrl = "https://raw.githubusercontent.com/actions/virtual-environments/main/images/win/toolsets/toolset-2022.json"
|
||||
$latestMinorVersion = (Invoke-RestMethod $toolsetUrl).toolcache |
|
||||
Where-Object {$_.name -eq $ToolName -and $_.arch -eq $FilterArch} |
|
||||
ForEach-Object {$_.versions.Replace("*","0")} |
|
||||
Select-Object -Last 1
|
||||
$versionsToAdd = $stableReleaseVersions | Where-Object {[version]$_ -gt [version]$latestMinorVersion}
|
||||
|
||||
return $versionsToAdd
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
function Search-PythonVersionsNotOnImage {
|
||||
param (
|
||||
[string]$ToolName,
|
||||
[string]$ReleasesUrl,
|
||||
[string]$FilterParameter,
|
||||
[string]$FilterArch
|
||||
)
|
||||
|
||||
$stableReleases = (Invoke-RestMethod $ReleasesUrl) |
|
||||
Where-Object stable -eq $true |
|
||||
ForEach-Object {$_.$FilterParameter.split(".")[0,1] -join"."} |
|
||||
Select-Object -Unique
|
||||
$toolsetUrl = "https://raw.githubusercontent.com/actions/virtual-environments/main/images/win/toolsets/toolset-2022.json"
|
||||
$latestVersion = ((Invoke-RestMethod $toolsetUrl).toolcache |
|
||||
Where-Object {$_.name -eq $ToolName -and $_.arch -eq $FilterArch}).versions |
|
||||
Select-Object -Last 1
|
||||
$latestMinorVesion = $latestVersion.TrimEnd(".*")
|
||||
$versionsToAdd = $stableReleases | Where-Object {[version]$_ -gt [version]$latestMinorVesion}
|
||||
|
||||
return $versionsToAdd
|
||||
}
|
||||
@@ -3,25 +3,22 @@
|
||||
Check and return list of new available tool versions that not added to toolsets yet
|
||||
|
||||
.PARAMETER ToolName
|
||||
Required parameter. The name of tool for which parser is available (Python, Xamarin, PyPy)
|
||||
Required parameter. The name of tool for which parser is available (Python, Xamarin, PyPy, Node, Go)
|
||||
#>
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateSet("Python", "Xamarin", "PyPy")]
|
||||
[string]$ToolName
|
||||
[ValidateSet("Python", "Xamarin", "PyPy", "Node", "Go")]
|
||||
[string] $ToolName,
|
||||
[string] $ReleasesUrl,
|
||||
[string] $FilterParameter,
|
||||
[string] $FilterArch
|
||||
)
|
||||
|
||||
Get-ChildItem "$PSScriptRoot/parsers/verify-added-to-image/" | ForEach-Object {Import-Module $_.FullName}
|
||||
|
||||
if ($ToolName -eq "Python") {
|
||||
$pythonVesionsManifestUrl = "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json"
|
||||
$versionsToAdd = Search-PythonVersionsNotOnImage -ToolName $ToolName -ReleasesUrl $pythonVesionsManifestUrl -FilterParameter "version" -FilterArch "x64"
|
||||
}
|
||||
|
||||
if ($ToolName -eq "PyPy") {
|
||||
$pypyReleases = "https://downloads.python.org/pypy/versions.json"
|
||||
$versionsToAdd = Search-PythonVersionsNotOnImage -ToolName $ToolName -ReleasesUrl $pypyReleases -FilterParameter "python_version" -FilterArch "x86"
|
||||
if ($ToolName -in "Python", "PyPy", "Node", "Go") {
|
||||
$versionsToAdd = Search-ToolsVersionsNotOnImage -ToolName $ToolName -ReleasesUrl $ReleasesUrl -FilterParameter $FilterParameter -FilterArch $FilterArch
|
||||
}
|
||||
|
||||
if ($ToolName -eq "Xamarin") {
|
||||
|
||||
Reference in New Issue
Block a user