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
19
windev.ps1
19
windev.ps1
@ -42,24 +42,17 @@ function Get-WinUtilReleaseTag {
|
||||
break
|
||||
}
|
||||
|
||||
# Filter through the released versions and select the first matching stable version.
|
||||
$StableRelease = $ReleasesList | Where-Object { $_.prerelease -eq $false } | Select-Object -First 1
|
||||
# Filter through the released versions and select the first matching stable or pre-release version.
|
||||
$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.
|
||||
$PreRelease = $ReleasesList | Where-Object { $_.prerelease -eq $true } | Select-Object -First 1
|
||||
|
||||
# If a stable or pre-release version is found, set the release tag to the returned version number.
|
||||
if ($ReleasesList -and ($PreRelease -or $StableRelease)) {
|
||||
# Set the release tag based on the available releases; if no release tag is found use the 'latest' tag.
|
||||
$ReleaseTag = if ($PreRelease) {
|
||||
$PreRelease.tag_name
|
||||
} 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"
|
||||
} else {
|
||||
"latest"
|
||||
}
|
||||
|
||||
# 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