diff --git a/dist/setup/index.js b/dist/setup/index.js index 0dcd2342d..339fc8286 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -61447,28 +61447,38 @@ function installGoVersion(info, auth, arch) { const isWindows = os_1.default.platform() === 'win32'; const tempDir = process.env.RUNNER_TEMP || '.'; const fileName = isWindows ? path.join(tempDir, info.fileName) : undefined; + core.info(`Temporary directory ${os_1.default.tmpdir()}`); const downloadPath = yield tc.downloadTool(info.downloadUrl, fileName, auth); core.info('Extracting Go...'); - let extPath = yield extractGoArchive(downloadPath); + const cachedDir = path.join(process.env['RUNNER_TOOL_CACHE'], 'Go', makeSemver(info.resolvedVersion), arch); + let extPath = yield extractGoArchive(downloadPath, cachedDir); core.info(`Successfully extracted go to ${extPath}`); if (info.type === 'dist') { extPath = path.join(extPath, 'go'); } - core.info('Adding to the cache ...'); - const cachedDir = yield tc.cacheDir(extPath, 'go', makeSemver(info.resolvedVersion), arch); + // core.info('Adding to the cache ...'); + // const cachedDir = await tc.cacheDir( + // extPath, + // 'go', + // makeSemver(info.resolvedVersion), + // arch + // ); core.info(`Successfully cached go to ${cachedDir}`); return cachedDir; }); } -function extractGoArchive(archivePath) { +function extractGoArchive(archivePath, dest) { return __awaiter(this, void 0, void 0, function* () { const platform = os_1.default.platform(); let extPath; + if (!fs_1.default.existsSync(dest)) { + fs_1.default.mkdirSync(dest, { recursive: true }); + } if (platform === 'win32') { - extPath = yield tc.extractZip(archivePath); + extPath = yield tc.extractZip(archivePath, dest); } else { - extPath = yield tc.extractTar(archivePath); + extPath = yield tc.extractTar(archivePath, dest); } return extPath; }); diff --git a/src/installer.ts b/src/installer.ts index 013fb6405..8c04ba4fd 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -175,35 +175,48 @@ async function installGoVersion( const isWindows = os.platform() === 'win32'; const tempDir = process.env.RUNNER_TEMP || '.'; const fileName = isWindows ? path.join(tempDir, info.fileName) : undefined; - + core.info(`Temporary directory ${os.tmpdir()}`); const downloadPath = await tc.downloadTool(info.downloadUrl, fileName, auth); core.info('Extracting Go...'); - let extPath = await extractGoArchive(downloadPath); + const cachedDir = path.join( + process.env['RUNNER_TOOL_CACHE']!, + 'Go', + makeSemver(info.resolvedVersion), + arch + ); + let extPath = await extractGoArchive(downloadPath, cachedDir); core.info(`Successfully extracted go to ${extPath}`); if (info.type === 'dist') { extPath = path.join(extPath, 'go'); } - core.info('Adding to the cache ...'); - const cachedDir = await tc.cacheDir( - extPath, - 'go', - makeSemver(info.resolvedVersion), - arch - ); + // core.info('Adding to the cache ...'); + // const cachedDir = await tc.cacheDir( + // extPath, + // 'go', + // makeSemver(info.resolvedVersion), + // arch + // ); core.info(`Successfully cached go to ${cachedDir}`); return cachedDir; } -export async function extractGoArchive(archivePath: string): Promise { +export async function extractGoArchive( + archivePath: string, + dest: string +): Promise { const platform = os.platform(); let extPath: string; + if (!fs.existsSync(dest)) { + fs.mkdirSync(dest, {recursive: true}); + } + if (platform === 'win32') { - extPath = await tc.extractZip(archivePath); + extPath = await tc.extractZip(archivePath, dest); } else { - extPath = await tc.extractTar(archivePath); + extPath = await tc.extractTar(archivePath, dest); } return extPath;