You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Setup Supabase CLI, supabase, on GitHub Actions runners
author: Supabase
inputs:
version:
description: Supabase CLI version to install. Supports latest, beta, next (upcoming major prereleases only; can lag behind latest after a major goes GA), v<N>.stable (maintenance line of an older major, like v2.stable), or a fixed version published to npm. If omitted, detect from the root lockfile and otherwise use latest.
required: false
outputs:
version:
description: Version of installed Supabase CLI
value: ${{ steps.setup-cli.outputs.version }}
runs:
using: composite
steps:
- id: bun-download
name: Resolve Bun Download URL
shell: sh
working-directory: ${{ github.action_path }}
run: |
set -eu
is_musl=false
if [ "${RUNNER_OS}" = "Linux" ]; then
# setup-bun does not detect Linux musl yet, so Alpine-like containers need the musl asset explicitly.
if ! apk info -e "${package}" >/dev/null 2>&1; then
missing_packages="${missing_packages} ${package}"
fi
done
if ! command -v node >/dev/null 2>&1 || ! node -p 'process.versions.node' >/dev/null 2>&1; then
if [ -x /usr/bin/node ] && PATH="/usr/bin:${PATH}" /usr/bin/node -p 'process.versions.node' >/dev/null 2>&1; then
prefer_apk_bin=true
else
missing_packages="${missing_packages} nodejs"
fi
fi
if ! command -v npm >/dev/null 2>&1 || ! npm --version >/dev/null 2>&1; then
if [ -x /usr/bin/npm ] && PATH="/usr/bin:${PATH}" /usr/bin/npm --version >/dev/null 2>&1; then
prefer_apk_bin=true
else
missing_packages="${missing_packages} npm"
fi
fi
if [ "${prefer_apk_bin}" = "true" ]; then
echo "/usr/bin" >> "$GITHUB_PATH"
fi
if [ -z "${missing_packages}" ]; then
exit 0
fi
if [ "$(id -u)" != "0" ]; then
echo "::error::Alpine/musl containers need${missing_packages} to run Supabase CLI. Add 'apk add --no-cache${missing_packages}' before supabase/setup-cli, or run this job container as root."
exit 1
fi
apk add --no-cache ${missing_packages}
if echo " ${missing_packages} " | grep -Eq ' (nodejs|npm) '; then
echo "/usr/bin" >> "$GITHUB_PATH"
fi
exit 0
fi
echo "::error::Linux musl containers need libstdc++, libgcc, nodejs, and npm to run Supabase CLI. Install them before supabase/setup-cli."
if [ -n "${node_version}" ] && [ "${has_npm}" = "true" ]; then
case "${node_major}" in
''|*[!0-9]*)
echo "::error::Could not determine Node.js version from '${node_version}'. Supabase CLI npm installs require Node.js 20 or newer."
exit 1
;;
esac
if [ "${node_major}" -lt 20 ]; then
echo "::error::Supabase CLI npm installs require Node.js 20 or newer, but found Node.js ${node_version}. Set up Node.js 20+ before supabase/setup-cli, or use a runner image with Node.js 20+ and npm."
exit 1
fi
echo "setup-node=false" >> "$GITHUB_OUTPUT"
exit 0
fi
if [ "${{ steps.bun-download.outputs.is-musl }}" = "true" ]; then
echo "::error::Linux musl containers need Node.js 20 or newer and npm from musl-compatible packages. Install libstdc++, libgcc, nodejs, and npm before supabase/setup-cli, or run this job container as root so the action can install them."
exit 1
fi
if [ -n "${node_version}" ] || [ "${has_npm}" = "true" ]; then
echo "::error::Supabase CLI npm installs need both Node.js 20+ and npm. Found Node.js '${node_version:-missing}' and npm '${has_npm}'. Configure both before supabase/setup-cli."