Path join (#92)

This commit is contained in:
Shohei Ueda
2019-11-22 11:14:44 +09:00
committed by GitHub
parent 1490c6e417
commit ef869fb22f
2 changed files with 45 additions and 6 deletions

View File

@@ -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);