diff --git a/.forgejo/actions/linux-setup/action.yml b/.forgejo/actions/linux-setup/action.yml index a16be63..ec2f37f 100644 --- a/.forgejo/actions/linux-setup/action.yml +++ b/.forgejo/actions/linux-setup/action.yml @@ -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" diff --git a/.forgejo/workflows/acceptance.yml b/.forgejo/workflows/acceptance.yml index cc5cbb2..e6a4b22 100644 --- a/.forgejo/workflows/acceptance.yml +++ b/.forgejo/workflows/acceptance.yml @@ -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 diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index d0d95da..ff134a6 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -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 diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index ee88ef0..e77a9fd 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -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 diff --git a/tools/ci-install-bun.sh b/tools/ci-install-bun.sh new file mode 100644 index 0000000..8071050 --- /dev/null +++ b/tools/ci-install-bun.sh @@ -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-), +# 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