download most recent release instead of latest

This commit is contained in:
Baipyrus 2024-09-22 15:03:15 +02:00 committed by GitHub
parent 78cd3f1734
commit 9fd7fb2c37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,7 +45,10 @@ if ($isRelease)
# Download release files from github as-is
Write-Host "Downloading program into local directory..." -ForegroundColor Cyan
Invoke-RestMethod "https://github.com/Baipyrus/ProxySwitcher/releases/latest/download/ProxySwitcher.zip" -OutFile $tmpPRSWzip
$releases = Invoke-RestMethod "https://api.github.com/repos/Baipyrus/ProxySwitcher/releases"
$assets = $releases[0].assets
$archive = $assets | Where-Object name -match "zip"
Invoke-RestMethod $archive.browser_download_url -OutFile $tmpPRSWzip
# Expand Archive to program directory
Expand-Archive $tmpPRSWzip -DestinationPath $programPath -Force