refactor(ci): enhance download process in CI and release workflows

- Updated the download logic in both ci.yml and release.yml to include error handling for Invoke-WebRequest.
- Added a fallback to curl.exe for downloading packages if the initial request fails, improving reliability in package retrieval.

Benefits:
- Increases robustness of the CI and release workflows by ensuring successful downloads even in case of network issues.
- Enhances maintainability by centralizing download logic and error handling in the workflow scripts.
This commit is contained in:
scawful
2025-10-15 14:36:40 -04:00
parent 1ef0419de0
commit 71a573aee4
2 changed files with 12 additions and 2 deletions

View File

@@ -142,7 +142,12 @@ jobs:
$destination = Join-Path $downloads $pkg.Name
if (-not (Test-Path $destination)) {
Write-Host "Downloading $($pkg.Name)"
Invoke-WebRequest -Uri $pkg.Url -OutFile $destination
try {
Invoke-WebRequest -Uri $pkg.Url -OutFile $destination -Headers @{ "Accept" = "application/octet-stream" }
} catch {
Write-Host "Invoke-WebRequest failed, retrying with curl.exe"
& curl.exe -L $pkg.Url -o $destination
}
} else {
Write-Host "$($pkg.Name) already present, skipping download"
}

View File

@@ -216,7 +216,12 @@ jobs:
$destination = Join-Path $downloads $pkg.Name
if (-not (Test-Path $destination)) {
Write-Host "Downloading $($pkg.Name)"
Invoke-WebRequest -Uri $pkg.Url -OutFile $destination
try {
Invoke-WebRequest -Uri $pkg.Url -OutFile $destination -Headers @{ "Accept" = "application/octet-stream" }
} catch {
Write-Host "Invoke-WebRequest failed, retrying with curl.exe"
& curl.exe -L $pkg.Url -o $destination
}
} else {
Write-Host "$($pkg.Name) already present, skipping download"
}