优化 Bun 下载逻辑,简化代码结构
This commit is contained in:
@@ -72,25 +72,12 @@ jobs:
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
BUN_ASSET="bun-linux-${BUN_ARCH}.zip"
|
BUN_ASSET="bun-linux-${BUN_ARCH}.zip"
|
||||||
BUN_URLS="
|
BUN_URL="https://ghfast.top/https://github.com/oven-sh/bun/releases/latest/download/${BUN_ASSET}"
|
||||||
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
|
rm -f /tmp/bun.zip
|
||||||
download_success=0
|
echo "Trying Bun download: ${BUN_URL}"
|
||||||
for bun_url in $BUN_URLS; do
|
if ! curl -fL --connect-timeout 15 --max-time 180 --retry 2 --retry-delay 3 "$BUN_URL" -o /tmp/bun.zip; then
|
||||||
echo "Trying Bun download: ${bun_url}"
|
echo "Failed to download Bun from configured mirror."
|
||||||
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user