3
0
Fork 0
mirror of https://gitea.com/actions/setup-node.git synced 2024-11-25 11:39:32 +01:00

only node binary issue

This commit is contained in:
Bryan MacFarlane 2020-05-03 18:09:05 -04:00
parent f7c5caf605
commit dd6f5ab66c
2 changed files with 13 additions and 8 deletions

12
dist/index.js vendored
View file

@ -12975,7 +12975,6 @@ const io = __importStar(__webpack_require__(1));
const tc = __importStar(__webpack_require__(533));
const path = __importStar(__webpack_require__(622));
const semver = __importStar(__webpack_require__(280));
const fs = __webpack_require__(747);
function getNode(versionSpec, stable, token) {
return __awaiter(this, void 0, void 0, function* () {
let osPlat = os.platform();
@ -13005,7 +13004,8 @@ function getNode(versionSpec, stable, token) {
}
catch (err) {
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
return yield acquireNodeFromFallbackLocation(info.resolvedVersion);
yield acquireNodeFromFallbackLocation(info.resolvedVersion);
return;
}
throw err;
}
@ -13015,12 +13015,9 @@ function getNode(versionSpec, stable, token) {
let extPath;
if (osPlat == 'win32') {
let _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe');
console.log(`downloadPath: ${downloadPath}`, `isFile: ${fs.statSync(downloadPath).isFile()}`);
console.log(JSON.stringify(fs.statSync(downloadPath)));
extPath = yield tc.extract7z(downloadPath, undefined, _7zPath);
// 7z extracts to folder matching file name
extPath = path.join(extPath, path.basename(info.fileName, '.7z'));
console.log(`extPath: ${extPath}`, `isDirectory: ${fs.statSync(extPath).isDirectory()}`);
}
else {
extPath = yield tc.extractTar(downloadPath, undefined, [
@ -13187,6 +13184,7 @@ function acquireNodeFromFallbackLocation(version) {
try {
exeUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.exe`;
libUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.lib`;
console.log(`Downloading only node binary from ${exeUrl}`);
const exePath = yield tc.downloadTool(exeUrl);
yield io.cp(exePath, path.join(tempDir, 'node.exe'));
const libPath = yield tc.downloadTool(libUrl);
@ -13205,7 +13203,9 @@ function acquireNodeFromFallbackLocation(version) {
throw err;
}
}
return yield tc.cacheDir(tempDir, 'node', version);
let toolPath = yield tc.cacheDir(tempDir, 'node', version);
core.addPath(toolPath);
return toolPath;
});
}
// os.arch does not always match the relative download url, e.g.

View file

@ -64,7 +64,8 @@ export async function getNode(
downloadPath = await tc.downloadTool(info.downloadUrl, undefined, token);
} catch (err) {
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
return await acquireNodeFromFallbackLocation(info.resolvedVersion);
await acquireNodeFromFallbackLocation(info.resolvedVersion);
return;
}
throw err;
@ -269,6 +270,8 @@ async function acquireNodeFromFallbackLocation(
exeUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.exe`;
libUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.lib`;
console.log(`Downloading only node binary from ${exeUrl}`);
const exePath = await tc.downloadTool(exeUrl);
await io.cp(exePath, path.join(tempDir, 'node.exe'));
const libPath = await tc.downloadTool(libUrl);
@ -286,7 +289,9 @@ async function acquireNodeFromFallbackLocation(
throw err;
}
}
return await tc.cacheDir(tempDir, 'node', version);
let toolPath = await tc.cacheDir(tempDir, 'node', version);
core.addPath(toolPath);
return toolPath;
}
// os.arch does not always match the relative download url, e.g.