mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-10 03:13:23 +00:00
New parser for xamarin and python. Reworked workflow with composite actions (#41)
This commit is contained in:
@@ -14,6 +14,8 @@ Optional parameter. The pipeline URL
|
||||
Optional parameter. The image URL
|
||||
.PARAMETER Text
|
||||
Optional parameter. The message to post
|
||||
.PARAMETER AddToToolsetFlag
|
||||
Optional parameter. Flag to alternate message text for adding new version of a tool to toolset notification
|
||||
#>
|
||||
|
||||
param(
|
||||
@@ -28,7 +30,8 @@ param(
|
||||
[System.String]$ToolVersion,
|
||||
[System.String]$PipelineUrl,
|
||||
[System.String]$ImageUrl = 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png',
|
||||
[System.String]$Text
|
||||
[System.String]$Text,
|
||||
[Switch]$AddToToolsetFlag
|
||||
)
|
||||
|
||||
# Import helpers module
|
||||
@@ -36,15 +39,16 @@ Import-Module $PSScriptRoot/helpers.psm1 -DisableNameChecking
|
||||
|
||||
# Create JSON body
|
||||
if ([string]::IsNullOrWhiteSpace($Text)) {
|
||||
if ($toolName -eq "Xamarin") {
|
||||
if ($AddToToolsetFlag) {
|
||||
$Text = "The following versions of '$toolName' are available, consider adding them to toolset: $toolVersion"
|
||||
} else {
|
||||
$Text = "The following versions of '$toolName' are available to upload: $toolVersion"
|
||||
}
|
||||
if (-not ([string]::IsNullOrWhiteSpace($PipelineUrl))) {
|
||||
$Text += "\nLink to the pipeline: $pipelineUrl"
|
||||
}
|
||||
}
|
||||
if (-not ([string]::IsNullOrWhiteSpace($PipelineUrl))) {
|
||||
$Text += "\nLink to the pipeline: $pipelineUrl"
|
||||
}
|
||||
|
||||
$jsonBodyMessage = @"
|
||||
{
|
||||
"blocks": [
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
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)
|
||||
#>
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateSet("Python", "Xamarin")]
|
||||
[string]$ToolName
|
||||
)
|
||||
|
||||
if ($ToolName -eq "Python") {
|
||||
$pythonVesionsManifestUrl = "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json"
|
||||
$builtStableMinorVersions = (Invoke-RestMethod $pythonVesionsManifestUrl) |
|
||||
Where-Object stable -eq $true |
|
||||
ForEach-Object {$_.version.split(".")[0,1] -join"."} |
|
||||
Select-Object -Unique
|
||||
$toolsetUrl = "https://raw.githubusercontent.com/actions/virtual-environments/main/images/win/toolsets/toolset-2019.json"
|
||||
$latestExistingMinorVesion = ((Invoke-RestMethod $toolsetUrl).toolcache |
|
||||
Where-Object {$_.name -eq "Python" -and $_.arch -eq "x64"}).versions |
|
||||
ForEach-Object {$_.split(".")[0,1] -join"."} |
|
||||
Select-Object -Last 1
|
||||
$versionsToAdd = $builtStableMinorVersions | Where-Object {[version]$_ -gt [version]$latestExistingMinorVesion}
|
||||
}
|
||||
|
||||
if ($ToolName -eq "Xamarin") {
|
||||
$xamarinReleases = (Invoke-RestMethod "http://aka.ms/manifest/stable").items
|
||||
$xamarinProducts = @('Mono Framework', 'Xamarin.Android', 'Xamarin.iOS', 'Xamarin.Mac')
|
||||
$filteredReleases = $xamarinReleases | Where-Object {$_.name -in $xamarinProducts} | Sort-Object name | Select-Object name, version
|
||||
$toolsetUrl = "https://raw.githubusercontent.com/actions/virtual-environments/main/images/macos/toolsets/toolset-11.json"
|
||||
$uploadedReleases = (Invoke-RestMethod $toolsetUrl).xamarin
|
||||
$releasesOnImage = @{
|
||||
'Mono Framework' = $uploadedReleases.'mono-versions'
|
||||
'Xamarin.Android' = $uploadedReleases.'android-versions'
|
||||
'Xamarin.iOS' = $uploadedReleases.'ios-versions'
|
||||
'Xamarin.Mac' = $uploadedReleases.'mac-versions'
|
||||
}
|
||||
$versionsToAdd = $filteredReleases | Where-Object {$releasesOnImage[$_.name] -notcontains $_.version } | ForEach-Object {[string]::Empty} {
|
||||
'{0,-15} : {1}' -f $_.name, $_.version
|
||||
}
|
||||
$joinChars = "\n\t"
|
||||
}
|
||||
$versionsToAdd = $versionsToAdd -join $joinChars
|
||||
|
||||
return $versionsToAdd
|
||||
Reference in New Issue
Block a user