You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
versions-package-tools/get-new-tool-versions/get-new-tool-versions.ps1

36 lines
1.2 KiB
PowerShell

<#
.SYNOPSIS
Check and return list of new available tool versions
4 years ago
.PARAMETER ToolName
Required parameter. The name of tool for which parser is available (Node, Go, Python, Xamarin)
#>
param (
4 years ago
[Parameter(Mandatory)] [string] $ToolName
)
4 years ago
Import-Module "$PSScriptRoot/parsers/parsers-factory.psm1"
5 years ago
4 years ago
$ToolVersionParser = Get-ToolVersionsParser -ToolName $ToolName
$VersionsFromDist = $ToolVersionParser.GetAvailableVersions()
$VersionsFromManifest = $ToolVersionParser.GetUploadedVersions()
$joinChars = ", "
if ($ToolName -eq "Xamarin") {
$VersionsToBuild = $VersionsFromDist | Where-Object { $VersionsFromManifest[$_.name] -notcontains $_.version } | ForEach-Object {
'{0,-15} : {1}' -f $_.name, $_.version
}
$joinChars = "\n"
} else {
$VersionsToBuild = $VersionsFromDist | Where-Object { $VersionsFromManifest -notcontains $_ }
}
4 years ago
if ($VersionsToBuild) {
$availableVersions = $VersionsToBuild -join $joinChars
4 years ago
Write-Host "The following versions are available to build:`n${availableVersions}"
Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isOutput=true]${availableVersions}"
5 years ago
} else {
Write-Host "There aren't versions to build"
}