mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
Remove redundant $ReleasesList validation in Get-WinUtilReleaseTag
This commit is contained in:
parent
602a15cad8
commit
20d64fdbcd
27
windev.ps1
27
windev.ps1
@ -42,24 +42,17 @@ function Get-WinUtilReleaseTag {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
# Filter through the released versions and select the first matching stable version.
|
# Filter through the released versions and select the first matching stable or pre-release version.
|
||||||
$StableRelease = $ReleasesList | Where-Object { $_.prerelease -eq $false } | Select-Object -First 1
|
$StableRelease = $ReleasesList | Where-Object { -not $_.prerelease } | Select-Object -First 1
|
||||||
|
$PreRelease = $ReleasesList | Where-Object { $_.prerelease } | Select-Object -First 1
|
||||||
|
|
||||||
# Filter through the released versions and select the first matching pre-release version.
|
# Set the release tag based on the available releases; if no release tag is found use the 'latest' tag.
|
||||||
$PreRelease = $ReleasesList | Where-Object { $_.prerelease -eq $true } | Select-Object -First 1
|
$ReleaseTag = if ($PreRelease) {
|
||||||
|
$PreRelease.tag_name
|
||||||
# If a stable or pre-release version is found, set the release tag to the returned version number.
|
} elseif ($StableRelease) {
|
||||||
if ($ReleasesList -and ($PreRelease -or $StableRelease)) {
|
$StableRelease.tag_name
|
||||||
$ReleaseTag = if ($PreRelease) {
|
} else {
|
||||||
$PreRelease.tag_name
|
"latest"
|
||||||
} elseif ($StableRelease) {
|
|
||||||
$StableRelease.tag_name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# If no releases are found or a stable or pre-release doesn't exist default to using the 'latest' tag.
|
|
||||||
if (!$ReleasesList -or !($PreRelease -or $StableRelease)) {
|
|
||||||
$ReleaseTag = "latest"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Return the release tag to facilitate the usage of the version number within other parts of the script.
|
# Return the release tag to facilitate the usage of the version number within other parts of the script.
|
||||||
|
Loading…
Reference in New Issue
Block a user