Fix GitHub publish when release tag does not exist yet.
Some checks failed
Release Windows / build (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-10-07 10:24:38 +08:00
parent f19840ac7e
commit d150a060f2

View file

@ -73,8 +73,13 @@ if (-not (Get-Command gh -ErrorAction SilentlyContinue)) {
} }
Set-Location $repo Set-Location $repo
# gh writes "release not found" to stderr; keep Stop for the rest of the script.
$prevEap = $ErrorActionPreference
$ErrorActionPreference = "Continue"
$existing = gh release view $tag 2>$null $existing = gh release view $tag 2>$null
if ($LASTEXITCODE -eq 0) { $viewCode = $LASTEXITCODE
$ErrorActionPreference = $prevEap
if ($viewCode -eq 0) {
Write-Host "==> Release $tag exists; uploading assets" Write-Host "==> Release $tag exists; uploading assets"
gh release upload $tag $zip --clobber gh release upload $tag $zip --clobber
if (Test-Path $setup) { if (Test-Path $setup) {