diff --git a/lib/index.js b/lib/index.js index 073df90..6ca74b3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5154,6 +5154,17 @@ const io = __importStar(__webpack_require__(1)); const get_os_1 = __importDefault(__webpack_require__(443)); const get_url_1 = __importDefault(__webpack_require__(901)); const path = __importStar(__webpack_require__(622)); +let tempDir = process.env['RUNNER_TEMPDIRECTORY'] || ''; +if (!tempDir) { + let baseTempLocation; + if (process.platform === 'win32') { + baseTempLocation = process.env['USERPROFILE'] || 'C:\\'; + } + else { + baseTempLocation = `${process.env.HOME}`; + } + tempDir = path.join(baseTempLocation, 'tmp'); +} function installer(version) { return __awaiter(this, void 0, void 0, function* () { try { @@ -5170,19 +5181,18 @@ function installer(version) { else { baseLocation = `${process.env.HOME}`; } - console.log(`${process.env.HOME}`); - console.log(baseLocation); const hugoPath = path.join(baseLocation, 'hugobin'); yield io.mkdirP(hugoPath); core.addPath(hugoPath); + yield io.mkdirP(tempDir); const hugoAssets = yield tc.downloadTool(hugoURL); let hugoBin = ''; if (osName === 'Windows') { - const hugoExtractedFolder = yield tc.extractZip(hugoAssets, '/tmp'); + const hugoExtractedFolder = yield tc.extractZip(hugoAssets, tempDir); hugoBin = `${hugoExtractedFolder}/hugo.exe`; } else { - const hugoExtractedFolder = yield tc.extractTar(hugoAssets, '/tmp'); + const hugoExtractedFolder = yield tc.extractTar(hugoAssets, tempDir); hugoBin = `${hugoExtractedFolder}/hugo`; } yield io.mv(hugoBin, hugoPath); diff --git a/src/installer.ts b/src/installer.ts index a1db3ef..e2513a4 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -5,6 +5,17 @@ import getOS from './get-os'; import getURL from './get-url'; import * as path from 'path'; +let tempDir: string = process.env['RUNNER_TEMPDIRECTORY'] || ''; +if (!tempDir) { + let baseTempLocation: string; + if (process.platform === 'win32') { + baseTempLocation = process.env['USERPROFILE'] || 'C:\\'; + } else { + baseTempLocation = `${process.env.HOME}`; + } + tempDir = path.join(baseTempLocation, 'tmp'); +} + export default async function installer(version: string) { try { const extended: string = core.getInput('extended'); @@ -22,25 +33,24 @@ export default async function installer(version: string) { } else { baseLocation = `${process.env.HOME}`; } - console.log(`${process.env.HOME}`); - console.log(baseLocation); const hugoPath: string = path.join(baseLocation, 'hugobin'); await io.mkdirP(hugoPath); core.addPath(hugoPath); // Download and extract Hugo binary + await io.mkdirP(tempDir); const hugoAssets: string = await tc.downloadTool(hugoURL); let hugoBin: string = ''; if (osName === 'Windows') { const hugoExtractedFolder: string = await tc.extractZip( hugoAssets, - '/tmp' + tempDir ); hugoBin = `${hugoExtractedFolder}/hugo.exe`; } else { const hugoExtractedFolder: string = await tc.extractTar( hugoAssets, - '/tmp' + tempDir ); hugoBin = `${hugoExtractedFolder}/hugo`; }