Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { gte } from 'semver'
import {
getDownloadArchive,
determineInstalledVersion,
getCliPath
getCliPath,
installAlpineRuntimeDependencies
} from './utils.js'

export const CLI_CONFIG_REGISTRY = 'SUPABASE_INTERNAL_IMAGE_REGISTRY'
Expand Down Expand Up @@ -37,6 +38,8 @@ export async function run(): Promise<void> {
: await tc.extractTar(pathToArchive)
const pathToCLI = getCliPath(extractedPath, download.format)

await installAlpineRuntimeDependencies(download.format)

// Expose the tool by adding it to the PATH
core.addPath(pathToCLI)

Expand Down
31 changes: 31 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,37 @@ export const getCliPath = (
return archiveFormat === 'apk' ? `${extractedPath}/usr/bin` : extractedPath
}

export const installAlpineRuntimeDependencies = async (
archiveFormat: ArchiveFormat
): Promise<void> => {
if (archiveFormat !== 'apk') {
return
}

try {
await doExec('command -v apk')
} catch {
throw new Error(
'Linux musl containers need libstdc++ and libgcc to run Supabase CLI. Install them before supabase/setup-cli.'
)
}

try {
await doExec('apk info -e libstdc++ libgcc')
return
} catch {
const { stdout } = await doExec('id -u')
if (stdout.trim() !== '0') {
throw new Error(
"Alpine/musl containers need libstdc++ and libgcc to run Supabase CLI. Add 'apk add --no-cache libstdc++ libgcc' before supabase/setup-cli, or run this job container as root."
)
}
}

// The Supabase CLI shim in the apk dynamically links these Alpine runtime libraries.
await doExec('apk add --no-cache libstdc++ libgcc')
}

export const getDownloadUrl = async (
version: string,
githubToken?: string
Expand Down
Loading