Fix logic and URL to select the latest release (#2)

* Compile Winutil

* fix redirect to latest release

---------

Co-authored-by: Marterich <Marterich@users.noreply.github.com>
This commit is contained in:
Martin Wiethan 2024-06-30 13:13:04 +02:00 committed by GitHub
parent f838e805f3
commit b3bc01feea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,8 +20,6 @@ function Get-LatestRelease {
return $latestRelease.tag_name return $latestRelease.tag_name
} catch { } catch {
Write-Host "Error fetching release data: $_" -ForegroundColor Red Write-Host "Error fetching release data: $_" -ForegroundColor Red
Write-Host "Redirecting to latest Full Release"
$latestRelease = "releases/latest/download"
return $latestRelease.tag_name return $latestRelease.tag_name
} }
} }
@ -31,10 +29,12 @@ function RedirectToLatestPreRelease {
$latestRelease = Get-LatestRelease $latestRelease = Get-LatestRelease
if ($latestRelease) { if ($latestRelease) {
$url = "https://raw.githubusercontent.com/ChrisTitusTech/winutil/$latestRelease/winutil.ps1" $url = "https://raw.githubusercontent.com/ChrisTitusTech/winutil/$latestRelease/winutil.ps1"
Invoke-RestMethod $url | Invoke-Expression
} else { } else {
Write-Host 'Unable to determine latest pre-release version.' -ForegroundColor Red Write-Host 'Unable to determine latest pre-release version.' -ForegroundColor Red
Write-Host "Using latest Full Release"
$url = "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1"
} }
Invoke-RestMethod $url | Invoke-Expression
} }
# Call the redirect function # Call the redirect function