优化 Bun 下载逻辑,简化代码结构
This commit is contained in:
@@ -72,25 +72,12 @@ jobs:
|
||||
esac
|
||||
|
||||
BUN_ASSET="bun-linux-${BUN_ARCH}.zip"
|
||||
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}
|
||||
"
|
||||
BUN_URL="https://ghfast.top/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."
|
||||
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
|
||||
echo "Failed to download Bun from configured mirror."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user