feat: add tempDir
This commit is contained in:
parent
38963a7f40
commit
bd659684a1
2 changed files with 28 additions and 8 deletions
18
lib/index.js
18
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue