mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-10 19:50:24 +00:00
Merge pull request #25 from actions/al-cheb/add-xamarin-tool
Add xamarin tool version check
This commit is contained in:
37
azure-pipelines/get-tool-versions-xamarin.yml
Normal file
37
azure-pipelines/get-tool-versions-xamarin.yml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
name: $(date:yyyyMMdd)$(rev:.r)
|
||||||
|
trigger: none
|
||||||
|
pr: none
|
||||||
|
schedules:
|
||||||
|
- cron: "0 8 * * Thu"
|
||||||
|
displayName: Daily build
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- main
|
||||||
|
always: true
|
||||||
|
|
||||||
|
variables:
|
||||||
|
PoolName: 'Azure Pipelines'
|
||||||
|
VmImage: 'ubuntu-18.04'
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- stage: Find_New_Versions
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- job: Find_New_Versions
|
||||||
|
pool:
|
||||||
|
name: $(PoolName)
|
||||||
|
vmImage: $(VmImage)
|
||||||
|
steps:
|
||||||
|
- template: /azure-pipelines/templates/get-tool-versions-steps.yml
|
||||||
|
|
||||||
|
- stage: Check_New_Versions
|
||||||
|
dependsOn: Find_New_Versions
|
||||||
|
jobs:
|
||||||
|
- job: Check_New_Versions
|
||||||
|
pool:
|
||||||
|
name: $(PoolName)
|
||||||
|
vmImage: $(VmImage)
|
||||||
|
variables:
|
||||||
|
ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ]
|
||||||
|
steps:
|
||||||
|
- template: /azure-pipelines/templates/check-versions.yml
|
||||||
@@ -21,7 +21,7 @@ steps:
|
|||||||
TargetType: inline
|
TargetType: inline
|
||||||
script: |
|
script: |
|
||||||
$ToolName = "$(TOOL_NAME)"
|
$ToolName = "$(TOOL_NAME)"
|
||||||
if ($ToolName -eq "Python") {
|
if ($ToolName -in @("Python", "Xamarin")) {
|
||||||
$PipelineUrl = " "
|
$PipelineUrl = " "
|
||||||
} else {
|
} else {
|
||||||
$PipelineUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)"
|
$PipelineUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Check and return list of new available tool versions
|
Check and return list of new available tool versions
|
||||||
|
|
||||||
.PARAMETER ToolName
|
.PARAMETER ToolName
|
||||||
Required parameter. The name of tool for which parser is available (Node, Go, Python)
|
Required parameter. The name of tool for which parser is available (Node, Go, Python, Xamarin)
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param (
|
param (
|
||||||
@@ -16,10 +16,18 @@ $ToolVersionParser = Get-ToolVersionsParser -ToolName $ToolName
|
|||||||
$VersionsFromDist = $ToolVersionParser.GetAvailableVersions()
|
$VersionsFromDist = $ToolVersionParser.GetAvailableVersions()
|
||||||
$VersionsFromManifest = $ToolVersionParser.GetUploadedVersions()
|
$VersionsFromManifest = $ToolVersionParser.GetUploadedVersions()
|
||||||
|
|
||||||
$VersionsToBuild = $VersionsFromDist | Where-Object { $VersionsFromManifest -notcontains $_ }
|
$joinChars = ", "
|
||||||
|
if ($ToolName -eq "Xamarin") {
|
||||||
|
$VersionsToBuild = $VersionsFromDist | Where-Object { $VersionsFromManifest[$_.name] -notcontains $_.version } | ForEach-Object {[string]::Empty} {
|
||||||
|
'{0,-15} : {1}' -f $_.name, $_.version
|
||||||
|
}
|
||||||
|
$joinChars = "\n\t"
|
||||||
|
} else {
|
||||||
|
$VersionsToBuild = $VersionsFromDist | Where-Object { $VersionsFromManifest -notcontains $_ }
|
||||||
|
}
|
||||||
|
|
||||||
if ($VersionsToBuild) {
|
if ($VersionsToBuild) {
|
||||||
$availableVersions = $VersionsToBuild -join ", "
|
$availableVersions = $VersionsToBuild -join $joinChars
|
||||||
Write-Host "The following versions are available to build:`n${availableVersions}"
|
Write-Host "The following versions are available to build:`n${availableVersions}"
|
||||||
Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isOutput=true]${availableVersions}"
|
Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isOutput=true]${availableVersions}"
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using module "./node-parser.psm1"
|
using module "./node-parser.psm1"
|
||||||
using module "./go-parser.psm1"
|
using module "./go-parser.psm1"
|
||||||
using module "./python-parser.psm1"
|
using module "./python-parser.psm1"
|
||||||
|
using module "./xamarin-parser.psm1"
|
||||||
|
|
||||||
function Get-ToolVersionsParser {
|
function Get-ToolVersionsParser {
|
||||||
param(
|
param(
|
||||||
@@ -12,6 +13,7 @@ function Get-ToolVersionsParser {
|
|||||||
"Node" { return [NodeVersionsParser]::New() }
|
"Node" { return [NodeVersionsParser]::New() }
|
||||||
"Go" { return [GoVersionsParser]::New() }
|
"Go" { return [GoVersionsParser]::New() }
|
||||||
"Python" { return [PythonVersionsParser]::New() }
|
"Python" { return [PythonVersionsParser]::New() }
|
||||||
|
"Xamarin" { return [XamarinversionsParser]::New() }
|
||||||
Default {
|
Default {
|
||||||
throw "Unknown tool name"
|
throw "Unknown tool name"
|
||||||
}
|
}
|
||||||
|
|||||||
30
get-new-tool-versions/parsers/xamarin-parser.psm1
Normal file
30
get-new-tool-versions/parsers/xamarin-parser.psm1
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using module "./base-parser.psm1"
|
||||||
|
|
||||||
|
class XamarinVersionsParser: BaseVersionsParser {
|
||||||
|
[PSCustomObject] GetAvailableVersions() {
|
||||||
|
$allVersions = $this.ParseAllAvailableVersions()
|
||||||
|
return $allVersions
|
||||||
|
}
|
||||||
|
|
||||||
|
[hashtable] GetUploadedVersions() {
|
||||||
|
$url = $this.BuildGitHubFileUrl("actions", "virtual-environments", "main", "images/macos/toolsets/toolset-11.0.json")
|
||||||
|
$releases = Invoke-RestMethod $url -MaximumRetryCount $this.ApiRetryCount -RetryIntervalSec $this.ApiRetryIntervalSeconds
|
||||||
|
$xamarin = $releases.xamarin
|
||||||
|
$xamarinReleases = @{
|
||||||
|
'Mono Framework' = $xamarin.'mono-versions'
|
||||||
|
'Xamarin.Android' = $xamarin.'android-versions'
|
||||||
|
'Xamarin.iOS' = $xamarin.'ios-versions'
|
||||||
|
'Xamarin.Mac' = $xamarin.'mac-versions'
|
||||||
|
}
|
||||||
|
return $xamarinReleases
|
||||||
|
}
|
||||||
|
|
||||||
|
hidden [PSCustomObject] ParseAllAvailableVersions() {
|
||||||
|
$url = "http://aka.ms/manifest/stable"
|
||||||
|
$filteredProducts = @('Mono Framework', 'Xamarin.Android', 'Xamarin.iOS', 'Xamarin.Mac')
|
||||||
|
$releases = Invoke-RestMethod $url -MaximumRetryCount $this.ApiRetryCount -RetryIntervalSec $this.ApiRetryIntervalSeconds
|
||||||
|
$items = $releases.items
|
||||||
|
$products = $items | Where-Object {$_.name -in $filteredProducts} | Sort-Object name | Select-Object name, version
|
||||||
|
return $products
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,11 @@ param(
|
|||||||
Import-Module $PSScriptRoot/helpers.psm1 -DisableNameChecking
|
Import-Module $PSScriptRoot/helpers.psm1 -DisableNameChecking
|
||||||
|
|
||||||
# Create JSON body
|
# Create JSON body
|
||||||
$text = "The following versions of '$toolName' are available to upload: $toolVersion"
|
if ($toolName -eq "Xamarin") {
|
||||||
|
$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))) {
|
if (-not ([string]::IsNullOrWhiteSpace($PipelineUrl))) {
|
||||||
$text += "\nLink to the pipeline: $pipelineUrl"
|
$text += "\nLink to the pipeline: $pipelineUrl"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user