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 {}
|
||||
|
||||
try {
|
||||
Invoke-RestMethod -Uri "${REPO_API}/releases/${RELEASE_ID}/assets?name=${encodedName}" `
|
||||
-Method Post -Headers $Headers -ContentType "application/octet-stream" `
|
||||
-InFile $_.FullName
|
||||
# Use curl for streaming upload (Invoke-RestMethod fails on large files)
|
||||
$uploadUrl = "${REPO_API}/releases/${RELEASE_ID}/assets?name=${encodedName}"
|
||||
$result = curl.exe --fail --silent --show-error `
|
||||
-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}"
|
||||
} catch {
|
||||
Write-Host "WARNING: Upload failed for ${filename}: $_"
|
||||
} else {
|
||||
Write-Host "WARNING: Upload failed for ${filename}: ${result}"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user