From 2bdb2ab1c9c7b4b2fd5b8c52e164982a093a6f6c Mon Sep 17 00:00:00 2001 From: Bryan MacFarlane Date: Sat, 2 May 2020 16:26:50 -0400 Subject: [PATCH] strip 1 on fallback extract --- dist/index.js | 48 ++++++++++++++++++++++++++++++++++++++--------- package-lock.json | 12 ++++++------ package.json | 2 +- src/installer.ts | 6 +++++- validate/test.sh | 2 +- 5 files changed, 52 insertions(+), 18 deletions(-) diff --git a/dist/index.js b/dist/index.js index ce5efe1e..eb529754 100644 --- a/dist/index.js +++ b/dist/index.js @@ -563,13 +563,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const os = __webpack_require__(87); -const events = __webpack_require__(614); -const child = __webpack_require__(129); -const path = __webpack_require__(622); -const io = __webpack_require__(1); -const ioUtil = __webpack_require__(672); +const os = __importStar(__webpack_require__(87)); +const events = __importStar(__webpack_require__(614)); +const child = __importStar(__webpack_require__(129)); +const path = __importStar(__webpack_require__(622)); +const io = __importStar(__webpack_require__(1)); +const ioUtil = __importStar(__webpack_require__(672)); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; /* @@ -1013,6 +1020,12 @@ class ToolRunner extends events.EventEmitter { resolve(exitCode); } }); + if (this.options.input) { + if (!cp.stdin) { + throw new Error('child process missing stdin'); + } + cp.stdin.end(this.options.input); + } }); }); } @@ -11076,7 +11089,13 @@ function extractTar(file, dest, flags = 'xz') { core.debug(versionOutput.trim()); const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR'); // Initialize args - const args = [flags]; + let args; + if (flags instanceof Array) { + args = flags; + } + else { + args = [flags]; + } let destArg = dest; let fileArg = file; if (IS_WINDOWS && isGnuTar) { @@ -12998,7 +13017,11 @@ function getNode(versionSpec, stable, token) { extPath = yield tc.extract7z(downloadPath, undefined, _7zPath); } else { - extPath = yield tc.extractTar(downloadPath); + extPath = yield tc.extractTar(downloadPath, undefined, [ + 'xz', + '--strip', + '1' + ]); } // // Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded @@ -16735,8 +16758,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const tr = __webpack_require__(9); +const tr = __importStar(__webpack_require__(9)); /** * Exec a command. * Output will be streamed to the live console. diff --git a/package-lock.json b/package-lock.json index f0ecde2a..26be5a56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,9 +10,9 @@ "integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg==" }, "@actions/exec": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.3.tgz", - "integrity": "sha512-TogJGnueOmM7ntCi0ASTUj4LapRRtDfj57Ja4IhPmg2fls28uVOPbAn8N+JifaOumN2UG3oEO/Ixek2A4NcYSA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", + "integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", "requires": { "@actions/io": "^1.0.1" } @@ -40,9 +40,9 @@ "integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==" }, "@actions/tool-cache": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.5.2.tgz", - "integrity": "sha512-40A1St0GEo+QvHV1YRjStEoQcKKMaip+zNXPgGHcjYXCdZ7cl1LGlwOpsVVqwk+6ue/shFTS76KC1A02mVVCQA==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.5.3.tgz", + "integrity": "sha512-G6OMdGvKVkApJv+nRURpi1nZUKonqWq37fqK8rdJLJr5PuWAEo/cqD/ibano7Da/LRx1yYFEMwO6RXkB2VaIqQ==", "requires": { "@actions/core": "^1.2.0", "@actions/exec": "^1.0.0", diff --git a/package.json b/package.json index c2c99d42..30352b92 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@actions/github": "^1.1.0", "@actions/http-client": "^1.0.6", "@actions/io": "^1.0.2", - "@actions/tool-cache": "^1.5.2", + "@actions/tool-cache": "^1.5.3", "semver": "^6.1.1" }, "devDependencies": { diff --git a/src/installer.ts b/src/installer.ts index d392c662..00bc64fc 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -77,7 +77,11 @@ export async function getNode( let _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe'); extPath = await tc.extract7z(downloadPath, undefined, _7zPath); } else { - extPath = await tc.extractTar(downloadPath); + extPath = await tc.extractTar(downloadPath, undefined, [ + 'xz', + '--strip', + '1' + ]); } // diff --git a/validate/test.sh b/validate/test.sh index d68687e9..f066edb8 100755 --- a/validate/test.sh +++ b/validate/test.sh @@ -13,7 +13,7 @@ rm -rf ./node export RUNNER_TOOL_CACHE=$(pwd) export RUNNER_TEMP="${RUNNER_TOOL_CACHE}/temp" export INPUT_STABLE=true -export INPUT_VERSION="12.x" +export INPUT_VERSION="12" #"0.12.7" #"12" #"11.15.0" # export your PAT with repo scope before running export INPUT_TOKEN=$GITHUB_TOKEN