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_os_1 = __importDefault(__webpack_require__(443));
|
||||||
const get_url_1 = __importDefault(__webpack_require__(901));
|
const get_url_1 = __importDefault(__webpack_require__(901));
|
||||||
const path = __importStar(__webpack_require__(622));
|
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) {
|
function installer(version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
|
|
@ -5170,19 +5181,18 @@ function installer(version) {
|
||||||
else {
|
else {
|
||||||
baseLocation = `${process.env.HOME}`;
|
baseLocation = `${process.env.HOME}`;
|
||||||
}
|
}
|
||||||
console.log(`${process.env.HOME}`);
|
|
||||||
console.log(baseLocation);
|
|
||||||
const hugoPath = path.join(baseLocation, 'hugobin');
|
const hugoPath = path.join(baseLocation, 'hugobin');
|
||||||
yield io.mkdirP(hugoPath);
|
yield io.mkdirP(hugoPath);
|
||||||
core.addPath(hugoPath);
|
core.addPath(hugoPath);
|
||||||
|
yield io.mkdirP(tempDir);
|
||||||
const hugoAssets = yield tc.downloadTool(hugoURL);
|
const hugoAssets = yield tc.downloadTool(hugoURL);
|
||||||
let hugoBin = '';
|
let hugoBin = '';
|
||||||
if (osName === 'Windows') {
|
if (osName === 'Windows') {
|
||||||
const hugoExtractedFolder = yield tc.extractZip(hugoAssets, '/tmp');
|
const hugoExtractedFolder = yield tc.extractZip(hugoAssets, tempDir);
|
||||||
hugoBin = `${hugoExtractedFolder}/hugo.exe`;
|
hugoBin = `${hugoExtractedFolder}/hugo.exe`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const hugoExtractedFolder = yield tc.extractTar(hugoAssets, '/tmp');
|
const hugoExtractedFolder = yield tc.extractTar(hugoAssets, tempDir);
|
||||||
hugoBin = `${hugoExtractedFolder}/hugo`;
|
hugoBin = `${hugoExtractedFolder}/hugo`;
|
||||||
}
|
}
|
||||||
yield io.mv(hugoBin, hugoPath);
|
yield io.mv(hugoBin, hugoPath);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,17 @@ import getOS from './get-os';
|
||||||
import getURL from './get-url';
|
import getURL from './get-url';
|
||||||
import * as path from 'path';
|
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) {
|
export default async function installer(version: string) {
|
||||||
try {
|
try {
|
||||||
const extended: string = core.getInput('extended');
|
const extended: string = core.getInput('extended');
|
||||||
|
|
@ -22,25 +33,24 @@ export default async function installer(version: string) {
|
||||||
} else {
|
} else {
|
||||||
baseLocation = `${process.env.HOME}`;
|
baseLocation = `${process.env.HOME}`;
|
||||||
}
|
}
|
||||||
console.log(`${process.env.HOME}`);
|
|
||||||
console.log(baseLocation);
|
|
||||||
const hugoPath: string = path.join(baseLocation, 'hugobin');
|
const hugoPath: string = path.join(baseLocation, 'hugobin');
|
||||||
await io.mkdirP(hugoPath);
|
await io.mkdirP(hugoPath);
|
||||||
core.addPath(hugoPath);
|
core.addPath(hugoPath);
|
||||||
|
|
||||||
// Download and extract Hugo binary
|
// Download and extract Hugo binary
|
||||||
|
await io.mkdirP(tempDir);
|
||||||
const hugoAssets: string = await tc.downloadTool(hugoURL);
|
const hugoAssets: string = await tc.downloadTool(hugoURL);
|
||||||
let hugoBin: string = '';
|
let hugoBin: string = '';
|
||||||
if (osName === 'Windows') {
|
if (osName === 'Windows') {
|
||||||
const hugoExtractedFolder: string = await tc.extractZip(
|
const hugoExtractedFolder: string = await tc.extractZip(
|
||||||
hugoAssets,
|
hugoAssets,
|
||||||
'/tmp'
|
tempDir
|
||||||
);
|
);
|
||||||
hugoBin = `${hugoExtractedFolder}/hugo.exe`;
|
hugoBin = `${hugoExtractedFolder}/hugo.exe`;
|
||||||
} else {
|
} else {
|
||||||
const hugoExtractedFolder: string = await tc.extractTar(
|
const hugoExtractedFolder: string = await tc.extractTar(
|
||||||
hugoAssets,
|
hugoAssets,
|
||||||
'/tmp'
|
tempDir
|
||||||
);
|
);
|
||||||
hugoBin = `${hugoExtractedFolder}/hugo`;
|
hugoBin = `${hugoExtractedFolder}/hugo`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue