Skip to content

Commit 31641a1

Browse files
committed
fix: more tool cache fixes
Signed-off-by: Sam Gammon <[email protected]>
1 parent 8c284d0 commit 31641a1

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ export async function run(
108108
? buildOptions(options)
109109
: buildOptions({
110110
version: stringOption(OptionName.VERSION, 'latest'),
111-
target: stringOption(
112-
OptionName.TARGET,
111+
install_path: stringOption(
112+
OptionName.INSTALL_PATH,
113113
/* istanbul ignore next */
114-
process.env.ELIDE_HOME || defaults.target
114+
process.env.ELIDE_HOME || defaults.install_path
115115
),
116116
os: normalizeOs(
117117
stringOption(OptionName.OS, process.platform) as string

src/options.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export enum OptionName {
1212
CUSTOM_URL = 'custom_url',
1313
VERSION_TAG = 'version_tag',
1414
TOKEN = 'token',
15-
TARGET = 'target',
15+
INSTALL_PATH = 'install_path',
1616
FORCE = 'force'
1717
}
1818

@@ -33,8 +33,8 @@ export interface ElideSetupActionOptions {
3333
// Desired arch for the downloaded binary. If not provided, the current arch is resolved.
3434
arch: 'amd64' | 'aarch64'
3535

36-
// Directory path where Elide should be installed; if none is provided, `~/elide` is used.
37-
target: string
36+
// Directory path where Elide should be installed; if none is provided, conventional location is used for GHA.
37+
install_path: string
3838

3939
// Whether to disable tool and action caching.
4040
no_cache: boolean
@@ -71,7 +71,7 @@ export const nixDefaultPath = path.resolve(os.homedir(), 'elide')
7171
export const configPath = path.resolve(os.homedir(), '.elide')
7272

7373
/* istanbul ignore next */
74-
const defaultTarget =
74+
const defaultTargetPath =
7575
process.platform === 'win32' ? windowsDefaultPath : nixDefaultPath
7676

7777
/**
@@ -85,7 +85,7 @@ export const defaults: ElideSetupActionOptions = {
8585
prewarm: true,
8686
os: normalizeOs(process.platform),
8787
arch: normalizeArch(process.arch),
88-
target: defaultTarget
88+
install_path: defaultTargetPath
8989
}
9090

9191
/**

src/releases.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,19 +284,21 @@ async function maybeDownload(
284284
): Promise<ElideRelease> {
285285
// build download URL, use result from cache or disk
286286
const { url, archiveType } = await buildDownloadUrl(options, version)
287-
core.info(`Installing from URL: ${url} (type: ${archiveType})`)
287+
let targetBin = `${options.install_path}/elide`
288288

289-
let targetBin = `${options.target}/elide`
289+
if (options.no_cache === true) {
290+
console.info('Tool caching is disabled.')
291+
}
290292

291293
/* istanbul ignore next */
292294
if (options.os === ElideOS.WINDOWS) {
293-
targetBin = `${options.target}\\elide.exe`
295+
targetBin = `${options.install_path}\\elide.exe`
294296
}
295297

296298
// build resulting tarball path and resolved tool info
297299
let elidePath: string = targetBin
298300
/* istanbul ignore next */
299-
let elideHome: string = process.env.ELIDE_HOME || options.target
301+
let elideHome: string = process.env.ELIDE_HOME || options.install_path
300302
let elidePathTarget = elideHome
301303
const elideBin: string = elideHome // @TODO(sgammon): bin folder?
302304
let elideDir: string | null = null
@@ -315,6 +317,7 @@ async function maybeDownload(
315317
// we have an existing cached copy of elide
316318
core.debug('Caching enabled and cached Elide release found; using it')
317319
elidePath = elideDir
320+
core.info(`Using cached copy of Elide at version ${version.tag_name}`)
318321
} else {
319322
/* istanbul ignore next */
320323
if (options.no_cache) {
@@ -325,6 +328,8 @@ async function maybeDownload(
325328
core.debug('Cache enabled but no hit was found; downloading release')
326329
}
327330

331+
core.info(`Installing from URL: ${url} (type: ${archiveType})`)
332+
328333
// we do not have an existing copy; download it
329334
let elideArchive: string | null = null
330335
try {
@@ -339,6 +344,7 @@ async function maybeDownload(
339344
}
340345

341346
core.debug(`Elide release downloaded to: ${elideArchive}`)
347+
342348
elideHome = await unpackRelease(
343349
elideArchive,
344350
elideHome,
@@ -400,7 +406,7 @@ export async function downloadRelease(
400406
}
401407

402408
/* istanbul ignore next */
403-
let elideHome: string = process.env.ELIDE_HOME || options.target
409+
let elideHome: string = process.env.ELIDE_HOME || options.install_path
404410
elideHome = await unpackRelease(
405411
customArchive,
406412
elideHome,

0 commit comments

Comments
 (0)