56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
name: Setup Bun
|
|
description: An internal version of the 'oven-sh/setup-bun' action.
|
|
|
|
inputs:
|
|
bun-version:
|
|
type: string
|
|
description: "The version of bun to install: 'latest', 'canary', 'bun-v1.2.0', etc."
|
|
default: latest
|
|
required: false
|
|
baseline:
|
|
type: boolean
|
|
description: "Whether to use the baseline version of bun."
|
|
default: false
|
|
required: false
|
|
download-url:
|
|
type: string
|
|
description: "The base URL to download bun from."
|
|
default: "https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases"
|
|
required: false
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Setup Bun
|
|
shell: bash
|
|
env:
|
|
BUN_VERSION: ${{ inputs.bun-version }}
|
|
BUN_BASELINE: ${{ inputs.baseline }}
|
|
BUN_DOWNLOAD_URL: ${{ inputs.download-url }}
|
|
run: |
|
|
case "$(uname -s)" in
|
|
Linux*) os=linux;;
|
|
Darwin*) os=darwin;;
|
|
*) os=windows;;
|
|
esac
|
|
case "$(uname -m)" in
|
|
arm64 | aarch64) arch=aarch64;;
|
|
*) arch=x64;;
|
|
esac
|
|
case "$BUN_BASELINE" in
|
|
true | 1) target="bun-${os}-${arch}-baseline";;
|
|
*) target="bun-${os}-${arch}";;
|
|
esac
|
|
case "$BUN_VERSION" in
|
|
latest) release="latest";;
|
|
canary) release="canary";;
|
|
*) release="bun-v${BUN_VERSION}";;
|
|
esac
|
|
curl -LO "${BUN_DOWNLOAD_URL}/${release}/${target}.zip" --retry 5
|
|
unzip "${target}.zip"
|
|
mkdir -p "$RUNNER_TEMP/.bun/bin"
|
|
mv "${target}"/bun* "$RUNNER_TEMP/.bun/bin/"
|
|
chmod +x "$RUNNER_TEMP"/.bun/bin/*
|
|
ln -fs "$RUNNER_TEMP/.bun/bin/bun" "$RUNNER_TEMP/.bun/bin/bunx"
|
|
echo "$RUNNER_TEMP/.bun/bin" >> "$GITHUB_PATH"
|