mirror of
https://github.com/supabase/setup-cli.git
synced 2026-06-28 01:46:58 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab058987d8 |
24
dist/index.js
generated
vendored
24
dist/index.js
generated
vendored
@@ -60534,6 +60534,29 @@ const getDownloadArchive = async (version, platform = os__default.platform(), ar
|
|||||||
const getCliPath = (extractedPath, archiveFormat) => {
|
const getCliPath = (extractedPath, archiveFormat) => {
|
||||||
return archiveFormat === 'apk' ? `${extractedPath}/usr/bin` : extractedPath;
|
return archiveFormat === 'apk' ? `${extractedPath}/usr/bin` : extractedPath;
|
||||||
};
|
};
|
||||||
|
const installAlpineRuntimeDependencies = async (archiveFormat) => {
|
||||||
|
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');
|
||||||
|
};
|
||||||
const determineInstalledVersion = async () => {
|
const determineInstalledVersion = async () => {
|
||||||
const { stdout } = await doExec('supabase --version');
|
const { stdout } = await doExec('supabase --version');
|
||||||
const version = stdout.trim();
|
const version = stdout.trim();
|
||||||
@@ -60562,6 +60585,7 @@ async function run() {
|
|||||||
? await extractZip(pathToArchive)
|
? await extractZip(pathToArchive)
|
||||||
: await extractTar(pathToArchive);
|
: await extractTar(pathToArchive);
|
||||||
const pathToCLI = getCliPath(extractedPath, download.format);
|
const pathToCLI = getCliPath(extractedPath, download.format);
|
||||||
|
await installAlpineRuntimeDependencies(download.format);
|
||||||
// Expose the tool by adding it to the PATH
|
// Expose the tool by adding it to the PATH
|
||||||
addPath(pathToCLI);
|
addPath(pathToCLI);
|
||||||
// Expose installed tool version
|
// Expose installed tool version
|
||||||
|
|||||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -4,7 +4,8 @@ import { gte } from 'semver'
|
|||||||
import {
|
import {
|
||||||
getDownloadArchive,
|
getDownloadArchive,
|
||||||
determineInstalledVersion,
|
determineInstalledVersion,
|
||||||
getCliPath
|
getCliPath,
|
||||||
|
installAlpineRuntimeDependencies
|
||||||
} from './utils.js'
|
} from './utils.js'
|
||||||
|
|
||||||
export const CLI_CONFIG_REGISTRY = 'SUPABASE_INTERNAL_IMAGE_REGISTRY'
|
export const CLI_CONFIG_REGISTRY = 'SUPABASE_INTERNAL_IMAGE_REGISTRY'
|
||||||
@@ -37,6 +38,8 @@ export async function run(): Promise<void> {
|
|||||||
: await tc.extractTar(pathToArchive)
|
: await tc.extractTar(pathToArchive)
|
||||||
const pathToCLI = getCliPath(extractedPath, download.format)
|
const pathToCLI = getCliPath(extractedPath, download.format)
|
||||||
|
|
||||||
|
await installAlpineRuntimeDependencies(download.format)
|
||||||
|
|
||||||
// Expose the tool by adding it to the PATH
|
// Expose the tool by adding it to the PATH
|
||||||
core.addPath(pathToCLI)
|
core.addPath(pathToCLI)
|
||||||
|
|
||||||
|
|||||||
31
src/utils.ts
31
src/utils.ts
@@ -157,6 +157,37 @@ export const getCliPath = (
|
|||||||
return archiveFormat === 'apk' ? `${extractedPath}/usr/bin` : extractedPath
|
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 (
|
export const getDownloadUrl = async (
|
||||||
version: string,
|
version: string,
|
||||||
githubToken?: string
|
githubToken?: string
|
||||||
|
|||||||
Reference in New Issue
Block a user