Add notifications to node and go

pull/44/head
Maksim Shilov 4 years ago
parent de5faa4d9c
commit 6df0bdfae0

@ -16,17 +16,40 @@ jobs:
tool:
- name: 'Xamarin'
image: 'https://avatars.githubusercontent.com/u/790012?s=200&v=4'
releases-url: 'null'
filter-parameter: 'null'
filter-arch: 'null'
- name: 'Python'
image: 'https://avatars.githubusercontent.com/u/1525981?s=200&v=4'
releases-url: 'https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json'
filter-parameter: 'version'
filter-arch: 'x64'
- name: 'PyPy'
image: 'https://avatars.githubusercontent.com/u/318667?s=200&v=4'
releases-url: 'https://downloads.python.org/pypy/versions.json'
filter-parameter: 'python_version'
filter-arch: 'x86'
- name: 'Node'
image: 'https://avatars.githubusercontent.com/u/9950313?s=200&v=4'
releases-url: 'https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json'
filter-parameter: 'version'
filter-arch: 'x64'
- name: 'Go'
image: 'https://avatars.githubusercontent.com/u/4314092?s=200&v=4'
releases-url: 'https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json'
filter-parameter: 'version'
filter-arch: 'x64'
name: 'Searching for new versions of ${{ matrix.tool.name }}'
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- id: get-new-tool-versions
name: Get new tool versions
run: echo "::set-output name=versions-output::$(./get-new-tool-versions/verify-new-tool-version-added-to-image.ps1 -ToolName ${{ matrix.tool.name }})"
run: echo "::set-output name=versions-output::$(./get-new-tool-versions/verify-new-tool-version-added-to-image.ps1 `
-ToolName ${{ matrix.tool.name }} `
-ReleasesUrl ${{ matrix.tool.releases-url }} `
-FilterParameter ${{ matrix.tool.filter-parameter }} `
-FilterArch ${{ matrix.tool.filter-arch }})"
- name: Check versions
if: steps.get-new-tool-versions.outputs.versions-output == ''
run: Write-Host "No new versions found"

@ -0,0 +1,25 @@
function Search-PythonVersionsNotOnImage {
param (
[string]$ToolName,
[string]$ReleasesUrl,
[string]$FilterParameter,
[string]$FilterArch
)
$stableReleases = (Invoke-RestMethod $ReleasesUrl) | Where-Object stable -eq $true
if ($ToolName -eq "Node") {
$stableReleaseVersions = $stableReleases | ForEach-Object {$_.$FilterParameter.split(".")[0] + ".0"} |
Select-Object -Unique
} else {
$stableReleaseVersions = $stableReleases | ForEach-Object {$_.$FilterParameter.split(".")[0,1] -join"."} |
Select-Object -Unique
}
$toolsetUrl = "https://raw.githubusercontent.com/shilovmaksim/virtual-environments/shilovmaksim/toolset-test/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.Replace("*","0")
$versionsToAdd = $stableReleaseVersions | Where-Object {[version]$_ -gt [version]$latestMinorVesion}
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") {

Loading…
Cancel
Save