mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-24 02:37:29 +01:00
Path join (#92)
This commit is contained in:
26
lib/index.js
26
lib/index.js
@@ -5153,6 +5153,18 @@ const tc = __importStar(__webpack_require__(533));
|
||||
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 {
|
||||
@@ -5162,17 +5174,25 @@ function installer(version) {
|
||||
console.log(`Operating System: ${osName}`);
|
||||
const hugoURL = get_url_1.default(osName, extended, version);
|
||||
core.debug(`hugoURL: ${hugoURL}`);
|
||||
const hugoPath = `${process.env.HOME}/bin`;
|
||||
let baseLocation;
|
||||
if (process.platform === 'win32') {
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
baseLocation = `${process.env.HOME}`;
|
||||
}
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user