mirror of
https://github.com/supabase/setup-cli.git
synced 2025-12-08 16:16:25 +00:00
Fix binary path
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import * as path from 'path'
|
||||
import {getDownloadObject} from './utils'
|
||||
import {getDownloadUrl} from './utils'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
@@ -9,14 +8,14 @@ async function run(): Promise<void> {
|
||||
const version = core.getInput('version')
|
||||
|
||||
// Download the specific version of the tool, e.g. as a tarball/zipball
|
||||
const download = getDownloadObject(version)
|
||||
const pathToTarball = await tc.downloadTool(download.url)
|
||||
const download = getDownloadUrl(version)
|
||||
const pathToTarball = await tc.downloadTool(download)
|
||||
|
||||
// Extract the tarball/zipball onto host runner
|
||||
const pathToCLI = await tc.extractTar(pathToTarball)
|
||||
|
||||
// Expose the tool by adding it to the PATH
|
||||
core.addPath(path.join(pathToCLI, download.binPath))
|
||||
core.addPath(pathToCLI)
|
||||
} catch (error) {
|
||||
if (error instanceof Error) core.setFailed(error.message)
|
||||
}
|
||||
|
||||
10
src/utils.ts
10
src/utils.ts
@@ -19,16 +19,10 @@ const mapOS = (platform: string): string => {
|
||||
return mappings[platform] || platform
|
||||
}
|
||||
|
||||
export const getDownloadObject = (
|
||||
version: string
|
||||
): {url: string; binPath: string} => {
|
||||
export const getDownloadUrl = (version: string): string => {
|
||||
const platform = mapOS(os.platform())
|
||||
const arch = mapArch(os.arch())
|
||||
const filename = `supabase_${version}_${platform}_${arch}`
|
||||
const binPath = platform === 'windows' ? 'bin' : path.join(filename, 'bin')
|
||||
const url = `https://github.com/supabase/cli/releases/download/v${version}/${filename}.tar.gz`
|
||||
return {
|
||||
url,
|
||||
binPath
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user