From be5e4c87ded27f7c14518f78ab634adcf3ce4224 Mon Sep 17 00:00:00 2001 From: Huarch Date: Tue, 19 May 2026 11:38:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20Bun=20=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=8C=E6=94=AF=E6=8C=81=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/package.yml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index 4e84b6d..bc0b456 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -56,6 +56,8 @@ jobs: - name: Install Bun run: | + set -euo pipefail + case "$(uname -m)" in x86_64) BUN_ARCH="x64" @@ -70,9 +72,28 @@ jobs: esac BUN_ASSET="bun-linux-${BUN_ARCH}.zip" - BUN_MIRROR_URL="https://ghproxy.net/https://github.com/oven-sh/bun/releases/latest/download/${BUN_ASSET}" + BUN_URLS=" + https://ghproxy.net/https://github.com/oven-sh/bun/releases/latest/download/${BUN_ASSET} + https://ghfast.top/https://github.com/oven-sh/bun/releases/latest/download/${BUN_ASSET} + https://github.moeyy.xyz/https://github.com/oven-sh/bun/releases/latest/download/${BUN_ASSET} + https://github.com/oven-sh/bun/releases/latest/download/${BUN_ASSET} + " + + rm -f /tmp/bun.zip + download_success=0 + for bun_url in $BUN_URLS; do + echo "Trying Bun download: ${bun_url}" + if curl -fL --connect-timeout 15 --max-time 180 --retry 2 --retry-delay 3 "$bun_url" -o /tmp/bun.zip; then + download_success=1 + break + fi + done + + if [ "$download_success" -ne 1 ]; then + echo "Failed to download Bun from all configured mirrors." + exit 1 + fi - curl -fL --retry 3 --retry-delay 5 "$BUN_MIRROR_URL" -o /tmp/bun.zip rm -rf "$HOME/.bun" mkdir -p "$HOME/.bun/bin" unzip -qo /tmp/bun.zip -d /tmp