ci: install bun from the npm registry (GitHub release assets answer 504 now and then), bun.sh with retries as fallback
This commit is contained in:
parent
96458bba5c
commit
3a22d7f455
5 changed files with 21 additions and 7 deletions
14
tools/ci-install-bun.sh
Normal file
14
tools/ci-install-bun.sh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
# Installs bun $1 (or $BUN_VERSION) into ~/.bun/bin on a Linux CI runner from the npm registry (@oven/bun-linux-<arch>),
|
||||
# because GitHub's oven-sh/bun release assets answer 504 now and then; bun.sh/install with retries is the fallback.
|
||||
set -u
|
||||
V="${1:-${BUN_VERSION:?BUN_VERSION}}"
|
||||
case "$(uname -m)" in aarch64|arm64) A=aarch64 ;; *) A=x64 ;; esac
|
||||
D="$HOME/.bun/bin"; mkdir -p "$D"; T=$(mktemp -d)
|
||||
for i in 1 2 3; do
|
||||
if curl -fsSL --max-time 120 "https://registry.npmjs.org/@oven/bun-linux-$A/-/bun-linux-$A-$V.tgz" | tar -xz -C "$T" \
|
||||
&& install -m 755 "$T/package/bin/bun" "$D/bun"; then ln -sf bun "$D/bunx"; "$D/bun" --version; exit 0; fi
|
||||
sleep 10
|
||||
done
|
||||
for i in 1 2 3; do curl -fsSL https://bun.sh/install | bash -s "bun-v$V" >/dev/null && { "$D/bun" --version; exit 0; }; sleep 20; done
|
||||
echo "bun $V: npm registry and GitHub both failed" >&2; exit 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue