Fix Windows release upload: use curl for streaming large file uploads
Invoke-RestMethod loads entire files into memory, causing connection failures on 360MB+ installer files. Switch to curl which streams the upload. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -128,12 +128,17 @@ jobs:
|
|||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
try {
|
# Use curl for streaming upload (Invoke-RestMethod fails on large files)
|
||||||
Invoke-RestMethod -Uri "${REPO_API}/releases/${RELEASE_ID}/assets?name=${encodedName}" `
|
$uploadUrl = "${REPO_API}/releases/${RELEASE_ID}/assets?name=${encodedName}"
|
||||||
-Method Post -Headers $Headers -ContentType "application/octet-stream" `
|
$result = curl.exe --fail --silent --show-error `
|
||||||
-InFile $_.FullName
|
-X POST `
|
||||||
|
-H "Authorization: token $env:BUILD_TOKEN" `
|
||||||
|
-H "Content-Type: application/octet-stream" `
|
||||||
|
--data-binary "@$($_.FullName)" `
|
||||||
|
"$uploadUrl" 2>&1
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
Write-Host "Upload successful: ${filename}"
|
Write-Host "Upload successful: ${filename}"
|
||||||
} catch {
|
} else {
|
||||||
Write-Host "WARNING: Upload failed for ${filename}: $_"
|
Write-Host "WARNING: Upload failed for ${filename}: ${result}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user