mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-11 03:56:46 +00:00
Merge pull request #25 from actions/al-cheb/add-xamarin-tool
Add xamarin tool version check
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using module "./node-parser.psm1"
|
||||
using module "./go-parser.psm1"
|
||||
using module "./python-parser.psm1"
|
||||
using module "./xamarin-parser.psm1"
|
||||
|
||||
function Get-ToolVersionsParser {
|
||||
param(
|
||||
@@ -12,6 +13,7 @@ function Get-ToolVersionsParser {
|
||||
"Node" { return [NodeVersionsParser]::New() }
|
||||
"Go" { return [GoVersionsParser]::New() }
|
||||
"Python" { return [PythonVersionsParser]::New() }
|
||||
"Xamarin" { return [XamarinversionsParser]::New() }
|
||||
Default {
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user