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
|
|
@ -35,7 +35,7 @@ runs:
|
|||
shell: bash
|
||||
run: |
|
||||
P="${FORGEJO_PATH:-$GITHUB_PATH}"
|
||||
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" >/dev/null
|
||||
bash tools/ci-install-bun.sh
|
||||
echo "$HOME/.bun/bin" >> "$P"
|
||||
command -v rustup || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||
echo "$HOME/.cargo/bin" >> "$P"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ jobs:
|
|||
if: ${{ matrix.platform == 'Linux' }}
|
||||
shell: bash
|
||||
run: |
|
||||
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" >/dev/null
|
||||
bash tools/ci-install-bun.sh
|
||||
echo "$HOME/.bun/bin" >> "${FORGEJO_PATH:-$GITHUB_PATH}"
|
||||
- name: Acceptance matrix (Linux)
|
||||
if: ${{ matrix.platform == 'Linux' }}
|
||||
|
|
@ -97,7 +97,7 @@ jobs:
|
|||
path: acceptance-runs/Windows-bun
|
||||
- name: Matrix (markdown), red cells fail the job
|
||||
run: |
|
||||
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" >/dev/null
|
||||
bash tools/ci-install-bun.sh
|
||||
export PATH="$HOME/.bun/bin:$PATH"
|
||||
V=$(bun tools/desktop-version.ts --print)
|
||||
mkdir -p out
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ jobs:
|
|||
if: ${{ matrix.platform == 'Linux' }}
|
||||
shell: bash
|
||||
run: |
|
||||
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" >/dev/null
|
||||
bash tools/ci-install-bun.sh
|
||||
echo "$HOME/.bun/bin" >> "${FORGEJO_PATH:-$GITHUB_PATH}"
|
||||
- name: Acceptance matrix (Linux)
|
||||
if: ${{ matrix.platform == 'Linux' }}
|
||||
|
|
@ -371,7 +371,7 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Tools
|
||||
run: |
|
||||
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" >/dev/null
|
||||
bash tools/ci-install-bun.sh
|
||||
echo "$HOME/.bun/bin" >> "${FORGEJO_PATH:-$GITHUB_PATH}"
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
|
|
@ -406,7 +406,7 @@ jobs:
|
|||
# no apt: the installers were scanned with the private terms in their own jobs; this job only records
|
||||
- name: Tools
|
||||
run: |
|
||||
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" >/dev/null
|
||||
bash tools/ci-install-bun.sh
|
||||
echo "$HOME/.bun/bin" >> "${FORGEJO_PATH:-$GITHUB_PATH}"
|
||||
[ -n "$FORGEJO_TOKEN" ] || { echo "secret RELEASE_TOKEN is missing (repo Settings > Actions > Secrets)" >&2; exit 1; }
|
||||
- uses: actions/download-artifact@v3
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ jobs:
|
|||
- name: Tag, package.json version, every version copy and the CHANGELOG agree
|
||||
id: check
|
||||
run: |
|
||||
curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" >/dev/null
|
||||
bash tools/ci-install-bun.sh
|
||||
echo "$HOME/.bun/bin" >> "${FORGEJO_PATH:-$GITHUB_PATH}"
|
||||
export PATH="$HOME/.bun/bin:$PATH"
|
||||
bun tools/desktop-version.ts
|
||||
|
|
|
|||
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