Compare commits
2
Commits
87a955ac67
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e459dfc78 | ||
|
|
1b12066e55 |
No files matched your search
@@ -17,9 +17,9 @@ jobs:
|
|||||||
target: x86_64-unknown-linux-gnu
|
target: x86_64-unknown-linux-gnu
|
||||||
use_cross: false
|
use_cross: false
|
||||||
archive_ext: tar.gz
|
archive_ext: tar.gz
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-24.04-arm
|
||||||
target: aarch64-unknown-linux-gnu
|
target: aarch64-unknown-linux-gnu
|
||||||
use_cross: true
|
use_cross: false
|
||||||
archive_ext: tar.gz
|
archive_ext: tar.gz
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
target: x86_64-apple-darwin
|
target: x86_64-apple-darwin
|
||||||
@@ -93,7 +93,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: assets-${{ matrix.target }}
|
name: assets-${{ matrix.target }}
|
||||||
path: dist/*
|
path: dist/*
|
||||||
archive: false
|
|
||||||
publish-release:
|
publish-release:
|
||||||
name: Publish Release
|
name: Publish Release
|
||||||
needs: build
|
needs: build
|
||||||
|
|||||||
+37
-2
@@ -58,14 +58,49 @@ $ChecksumUrl = "$DownloadUrl.sha256"
|
|||||||
$TempDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.Guid]::NewGuid().ToString())
|
$TempDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.Guid]::NewGuid().ToString())
|
||||||
New-Item -ItemType Directory -Force -Path $TempDir | Out-Null
|
New-Item -ItemType Directory -Force -Path $TempDir | Out-Null
|
||||||
|
|
||||||
|
function Download-File {
|
||||||
|
param(
|
||||||
|
[string]$Uri,
|
||||||
|
[string]$OutFile,
|
||||||
|
[int]$MaxRetries = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
$Attempt = 0
|
||||||
|
$DelaySeconds = 2
|
||||||
|
|
||||||
|
while ($Attempt -lt $MaxRetries) {
|
||||||
|
$Attempt++
|
||||||
|
|
||||||
|
try {
|
||||||
|
Invoke-WebRequest -Uri $Uri -OutFile $OutFile -Headers @{ "User-Agent" = "onx-installer" }
|
||||||
|
|
||||||
|
return
|
||||||
|
} catch {
|
||||||
|
$ErrorMessage = $_.Exception.Message
|
||||||
|
|
||||||
|
if ($Attempt -lt $MaxRetries) {
|
||||||
|
Write-Warning "Download attempt $Attempt failed ($ErrorMessage). Retrying in ${DelaySeconds}s..."
|
||||||
|
|
||||||
|
Start-Sleep -Seconds $DelaySeconds
|
||||||
|
|
||||||
|
$DelaySeconds = $DelaySeconds * 2
|
||||||
|
} else {
|
||||||
|
Write-Error "Failed to download $Uri after $MaxRetries attempts: $ErrorMessage"
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$ArchiveFile = Join-Path $TempDir $ArchiveName
|
$ArchiveFile = Join-Path $TempDir $ArchiveName
|
||||||
$ChecksumFile = Join-Path $TempDir "$ArchiveName.sha256"
|
$ChecksumFile = Join-Path $TempDir "$ArchiveName.sha256"
|
||||||
|
|
||||||
Write-Host "Downloading $BinaryName $Version for $Target..."
|
Write-Host "Downloading $BinaryName $Version for $Target..."
|
||||||
|
|
||||||
Invoke-WebRequest -Uri $DownloadUrl -OutFile $ArchiveFile
|
Download-File -Uri $DownloadUrl -OutFile $ArchiveFile
|
||||||
Invoke-WebRequest -Uri $ChecksumUrl -OutFile $ChecksumFile
|
Download-File -Uri $ChecksumUrl -OutFile $ChecksumFile
|
||||||
|
|
||||||
Write-Host "Verifying SHA256 checksum..."
|
Write-Host "Verifying SHA256 checksum..."
|
||||||
|
|
||||||
|
|||||||
+28
-8
@@ -71,15 +71,35 @@ TARGET="${ARCH}-${OS}"
|
|||||||
download() {
|
download() {
|
||||||
local url="$1"
|
local url="$1"
|
||||||
local output="$2"
|
local output="$2"
|
||||||
|
local max_retries=3
|
||||||
|
local attempt=0
|
||||||
|
local delay=2
|
||||||
|
|
||||||
if command -v curl >/dev/null 2>&1; then
|
while [ "$attempt" -lt "$max_retries" ]; do
|
||||||
curl -fsSL "$url" -o "$output"
|
attempt=$((attempt + 1))
|
||||||
elif command -v wget >/dev/null 2>&1; then
|
|
||||||
wget -qO "$output" "$url"
|
if command -v curl >/dev/null 2>&1; then
|
||||||
else
|
if curl -fsSL --retry 3 --retry-delay 2 -A "onx-installer" "$url" -o "$output"; then
|
||||||
echo "Error: Neither curl nor wget was found. Please install one of them." >&2
|
return 0
|
||||||
exit 1
|
fi
|
||||||
fi
|
elif command -v wget >/dev/null 2>&1; then
|
||||||
|
if wget -q --tries=3 --waitretry=2 --user-agent="onx-installer" -O "$output" "$url"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: Neither curl nor wget was found. Please install one of them." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$attempt" -lt "$max_retries" ]; then
|
||||||
|
echo "Download attempt ${attempt} failed. Retrying in ${delay}s..." >&2
|
||||||
|
sleep "$delay"
|
||||||
|
delay=$((delay * 2))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Error: Failed to download ${url} after ${max_retries} attempts." >&2
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "${REQUESTED_VERSION}" ]; then
|
if [ -z "${REQUESTED_VERSION}" ]; then
|
||||||
|
|||||||
Reference in new issue
Block a user