Fix test volta priority (#577)
This commit is contained in:
parent
9f3a02bbd1
commit
969bd26639
8
.github/workflows/versions.yml
vendored
8
.github/workflows/versions.yml
vendored
@ -95,6 +95,9 @@ jobs:
|
|||||||
node-version-file: [.nvmrc, .tool-versions, package.json]
|
node-version-file: [.nvmrc, .tool-versions, package.json]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
- name: Remove volta from package.json
|
||||||
|
shell: bash
|
||||||
|
run: cat <<< "$(jq 'del(.volta)' ./__tests__/data/package.json)" > ./__tests__/data/package.json
|
||||||
- name: Setup node from node version file
|
- name: Setup node from node version file
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@ -110,15 +113,12 @@ jobs:
|
|||||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Remove engines from package.json
|
|
||||||
shell: bash
|
|
||||||
run: cat <<< "$(jq 'del(.engines)' ./__tests__/data/package.json)" > ./__tests__/data/package.json
|
|
||||||
- name: Setup node from node version file
|
- name: Setup node from node version file
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
node-version-file: '__tests__/data/package.json'
|
node-version-file: '__tests__/data/package.json'
|
||||||
- name: Verify node
|
- name: Verify node
|
||||||
run: __tests__/verify-node.sh 14
|
run: __tests__/verify-node.sh 16
|
||||||
|
|
||||||
node-dist:
|
node-dist:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|||||||
@ -3,6 +3,6 @@
|
|||||||
"node": "^14.0.0"
|
"node": "^14.0.0"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "14.0.0"
|
"node": "16.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
376
dist/cache-save/index.js
vendored
376
dist/cache-save/index.js
vendored
@ -60979,74 +60979,74 @@ exports.fromPromise = function (fn) {
|
|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
const cache_utils_1 = __nccwpck_require__(1678);
|
const cache_utils_1 = __nccwpck_require__(1678);
|
||||||
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
||||||
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
||||||
// throw an uncaught exception. Instead of failing this action, just warn.
|
// throw an uncaught exception. Instead of failing this action, just warn.
|
||||||
process.on('uncaughtException', e => {
|
process.on('uncaughtException', e => {
|
||||||
const warningPrefix = '[warning]';
|
const warningPrefix = '[warning]';
|
||||||
core.info(`${warningPrefix}${e.message}`);
|
core.info(`${warningPrefix}${e.message}`);
|
||||||
});
|
});
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const cacheLock = core.getInput('cache');
|
const cacheLock = core.getInput('cache');
|
||||||
yield cachePackages(cacheLock);
|
yield cachePackages(cacheLock);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const state = core.getState(constants_1.State.CacheMatchedKey);
|
const state = core.getState(constants_1.State.CacheMatchedKey);
|
||||||
const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
|
const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
|
||||||
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
||||||
if (!packageManagerInfo) {
|
if (!packageManagerInfo) {
|
||||||
core.debug(`Caching for '${packageManager}' is not supported`);
|
core.debug(`Caching for '${packageManager}' is not supported`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
|
const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
|
||||||
if (!fs_1.default.existsSync(cachePath)) {
|
if (!fs_1.default.existsSync(cachePath)) {
|
||||||
throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePath}`);
|
throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePath}`);
|
||||||
}
|
}
|
||||||
if (primaryKey === state) {
|
if (primaryKey === state) {
|
||||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cacheId = yield cache.saveCache([cachePath], primaryKey);
|
const cacheId = yield cache.saveCache([cachePath], primaryKey);
|
||||||
if (cacheId == -1) {
|
if (cacheId == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||||
});
|
});
|
||||||
run();
|
run();
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -61055,109 +61055,109 @@ run();
|
|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
exports.supportedPackageManagers = {
|
exports.supportedPackageManagers = {
|
||||||
npm: {
|
npm: {
|
||||||
lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
|
lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
|
||||||
getCacheFolderCommand: 'npm config get cache'
|
getCacheFolderCommand: 'npm config get cache'
|
||||||
},
|
},
|
||||||
pnpm: {
|
pnpm: {
|
||||||
lockFilePatterns: ['pnpm-lock.yaml'],
|
lockFilePatterns: ['pnpm-lock.yaml'],
|
||||||
getCacheFolderCommand: 'pnpm store path --silent'
|
getCacheFolderCommand: 'pnpm store path --silent'
|
||||||
},
|
},
|
||||||
yarn1: {
|
yarn1: {
|
||||||
lockFilePatterns: ['yarn.lock'],
|
lockFilePatterns: ['yarn.lock'],
|
||||||
getCacheFolderCommand: 'yarn cache dir'
|
getCacheFolderCommand: 'yarn cache dir'
|
||||||
},
|
},
|
||||||
yarn2: {
|
yarn2: {
|
||||||
lockFilePatterns: ['yarn.lock'],
|
lockFilePatterns: ['yarn.lock'],
|
||||||
getCacheFolderCommand: 'yarn config get cacheFolder'
|
getCacheFolderCommand: 'yarn config get cacheFolder'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
||||||
if (exitCode) {
|
if (exitCode) {
|
||||||
stderr = !stderr.trim()
|
stderr = !stderr.trim()
|
||||||
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
|
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
|
||||||
: stderr;
|
: stderr;
|
||||||
throw new Error(stderr);
|
throw new Error(stderr);
|
||||||
}
|
}
|
||||||
return stdout.trim();
|
return stdout.trim();
|
||||||
});
|
});
|
||||||
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
|
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
|
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
|
||||||
if (!stdOut) {
|
if (!stdOut) {
|
||||||
throw new Error(`Could not retrieve version of ${packageManager}`);
|
throw new Error(`Could not retrieve version of ${packageManager}`);
|
||||||
}
|
}
|
||||||
return stdOut;
|
return stdOut;
|
||||||
});
|
});
|
||||||
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (packageManager === 'npm') {
|
if (packageManager === 'npm') {
|
||||||
return exports.supportedPackageManagers.npm;
|
return exports.supportedPackageManagers.npm;
|
||||||
}
|
}
|
||||||
else if (packageManager === 'pnpm') {
|
else if (packageManager === 'pnpm') {
|
||||||
return exports.supportedPackageManagers.pnpm;
|
return exports.supportedPackageManagers.pnpm;
|
||||||
}
|
}
|
||||||
else if (packageManager === 'yarn') {
|
else if (packageManager === 'yarn') {
|
||||||
const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
|
const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
|
||||||
core.debug(`Consumed yarn version is ${yarnVersion}`);
|
core.debug(`Consumed yarn version is ${yarnVersion}`);
|
||||||
if (yarnVersion.startsWith('1.')) {
|
if (yarnVersion.startsWith('1.')) {
|
||||||
return exports.supportedPackageManagers.yarn1;
|
return exports.supportedPackageManagers.yarn1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return exports.supportedPackageManagers.yarn2;
|
return exports.supportedPackageManagers.yarn2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
||||||
if (!stdOut) {
|
if (!stdOut) {
|
||||||
throw new Error(`Could not get cache folder path for ${packageManager}`);
|
throw new Error(`Could not get cache folder path for ${packageManager}`);
|
||||||
}
|
}
|
||||||
core.debug(`${packageManager} path is ${stdOut}`);
|
core.debug(`${packageManager} path is ${stdOut}`);
|
||||||
return stdOut.trim();
|
return stdOut.trim();
|
||||||
});
|
});
|
||||||
function isGhes() {
|
function isGhes() {
|
||||||
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
||||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isCacheFeatureAvailable() {
|
function isCacheFeatureAvailable() {
|
||||||
if (!cache.isFeatureAvailable()) {
|
if (!cache.isFeatureAvailable()) {
|
||||||
if (isGhes()) {
|
if (isGhes()) {
|
||||||
throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
|
throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -61166,23 +61166,23 @@ exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
|||||||
/***/ ((__unused_webpack_module, exports) => {
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
var LockType;
|
var LockType;
|
||||||
(function (LockType) {
|
(function (LockType) {
|
||||||
LockType["Npm"] = "npm";
|
LockType["Npm"] = "npm";
|
||||||
LockType["Pnpm"] = "pnpm";
|
LockType["Pnpm"] = "pnpm";
|
||||||
LockType["Yarn"] = "yarn";
|
LockType["Yarn"] = "yarn";
|
||||||
})(LockType = exports.LockType || (exports.LockType = {}));
|
})(LockType = exports.LockType || (exports.LockType = {}));
|
||||||
var State;
|
var State;
|
||||||
(function (State) {
|
(function (State) {
|
||||||
State["CachePrimaryKey"] = "CACHE_KEY";
|
State["CachePrimaryKey"] = "CACHE_KEY";
|
||||||
State["CacheMatchedKey"] = "CACHE_RESULT";
|
State["CacheMatchedKey"] = "CACHE_RESULT";
|
||||||
})(State = exports.State || (exports.State = {}));
|
})(State = exports.State || (exports.State = {}));
|
||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
Outputs["CacheHit"] = "cache-hit";
|
Outputs["CacheHit"] = "cache-hit";
|
||||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
1508
dist/setup/index.js
vendored
1508
dist/setup/index.js
vendored
@ -72875,62 +72875,62 @@ function wrappy (fn, cb) {
|
|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const fs = __importStar(__nccwpck_require__(7147));
|
const fs = __importStar(__nccwpck_require__(7147));
|
||||||
const os = __importStar(__nccwpck_require__(2037));
|
const os = __importStar(__nccwpck_require__(2037));
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const github = __importStar(__nccwpck_require__(5438));
|
const github = __importStar(__nccwpck_require__(5438));
|
||||||
function configAuthentication(registryUrl, alwaysAuth) {
|
function configAuthentication(registryUrl, alwaysAuth) {
|
||||||
const npmrc = path.resolve(process.env['RUNNER_TEMP'] || process.cwd(), '.npmrc');
|
const npmrc = path.resolve(process.env['RUNNER_TEMP'] || process.cwd(), '.npmrc');
|
||||||
if (!registryUrl.endsWith('/')) {
|
if (!registryUrl.endsWith('/')) {
|
||||||
registryUrl += '/';
|
registryUrl += '/';
|
||||||
}
|
}
|
||||||
writeRegistryToFile(registryUrl, npmrc, alwaysAuth);
|
writeRegistryToFile(registryUrl, npmrc, alwaysAuth);
|
||||||
}
|
}
|
||||||
exports.configAuthentication = configAuthentication;
|
exports.configAuthentication = configAuthentication;
|
||||||
function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
|
function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
|
||||||
let scope = core.getInput('scope');
|
let scope = core.getInput('scope');
|
||||||
if (!scope && registryUrl.indexOf('npm.pkg.github.com') > -1) {
|
if (!scope && registryUrl.indexOf('npm.pkg.github.com') > -1) {
|
||||||
scope = github.context.repo.owner;
|
scope = github.context.repo.owner;
|
||||||
}
|
}
|
||||||
if (scope && scope[0] != '@') {
|
if (scope && scope[0] != '@') {
|
||||||
scope = '@' + scope;
|
scope = '@' + scope;
|
||||||
}
|
}
|
||||||
if (scope) {
|
if (scope) {
|
||||||
scope = scope.toLowerCase();
|
scope = scope.toLowerCase();
|
||||||
}
|
}
|
||||||
core.debug(`Setting auth in ${fileLocation}`);
|
core.debug(`Setting auth in ${fileLocation}`);
|
||||||
let newContents = '';
|
let newContents = '';
|
||||||
if (fs.existsSync(fileLocation)) {
|
if (fs.existsSync(fileLocation)) {
|
||||||
const curContents = fs.readFileSync(fileLocation, 'utf8');
|
const curContents = fs.readFileSync(fileLocation, 'utf8');
|
||||||
curContents.split(os.EOL).forEach((line) => {
|
curContents.split(os.EOL).forEach((line) => {
|
||||||
// Add current contents unless they are setting the registry
|
// Add current contents unless they are setting the registry
|
||||||
if (!line.toLowerCase().startsWith('registry')) {
|
if (!line.toLowerCase().startsWith('registry')) {
|
||||||
newContents += line + os.EOL;
|
newContents += line + os.EOL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Remove http: or https: from front of registry.
|
// Remove http: or https: from front of registry.
|
||||||
const authString = registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}';
|
const authString = registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}';
|
||||||
const registryString = scope
|
const registryString = scope
|
||||||
? `${scope}:registry=${registryUrl}`
|
? `${scope}:registry=${registryUrl}`
|
||||||
: `registry=${registryUrl}`;
|
: `registry=${registryUrl}`;
|
||||||
const alwaysAuthString = `always-auth=${alwaysAuth}`;
|
const alwaysAuthString = `always-auth=${alwaysAuth}`;
|
||||||
newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
|
newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
|
||||||
fs.writeFileSync(fileLocation, newContents);
|
fs.writeFileSync(fileLocation, newContents);
|
||||||
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
|
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
|
||||||
// Export empty node_auth_token if didn't exist so npm doesn't complain about not being able to find it
|
// Export empty node_auth_token if didn't exist so npm doesn't complain about not being able to find it
|
||||||
core.exportVariable('NODE_AUTH_TOKEN', process.env.NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX');
|
core.exportVariable('NODE_AUTH_TOKEN', process.env.NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -72939,70 +72939,70 @@ function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
|
|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const glob = __importStar(__nccwpck_require__(8090));
|
const glob = __importStar(__nccwpck_require__(8090));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
const cache_utils_1 = __nccwpck_require__(1678);
|
const cache_utils_1 = __nccwpck_require__(1678);
|
||||||
exports.restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
||||||
if (!packageManagerInfo) {
|
if (!packageManagerInfo) {
|
||||||
throw new Error(`Caching for '${packageManager}' is not supported`);
|
throw new Error(`Caching for '${packageManager}' is not supported`);
|
||||||
}
|
}
|
||||||
const platform = process.env.RUNNER_OS;
|
const platform = process.env.RUNNER_OS;
|
||||||
const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
|
const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
|
||||||
const lockFilePath = cacheDependencyPath
|
const lockFilePath = cacheDependencyPath
|
||||||
? cacheDependencyPath
|
? cacheDependencyPath
|
||||||
: findLockFile(packageManagerInfo);
|
: findLockFile(packageManagerInfo);
|
||||||
const fileHash = yield glob.hashFiles(lockFilePath);
|
const fileHash = yield glob.hashFiles(lockFilePath);
|
||||||
if (!fileHash) {
|
if (!fileHash) {
|
||||||
throw new Error('Some specified paths were not resolved, unable to cache dependencies.');
|
throw new Error('Some specified paths were not resolved, unable to cache dependencies.');
|
||||||
}
|
}
|
||||||
const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
|
const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
|
||||||
core.debug(`primary key is ${primaryKey}`);
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
|
core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
|
||||||
const cacheKey = yield cache.restoreCache([cachePath], primaryKey);
|
const cacheKey = yield cache.restoreCache([cachePath], primaryKey);
|
||||||
core.setOutput('cache-hit', Boolean(cacheKey));
|
core.setOutput('cache-hit', Boolean(cacheKey));
|
||||||
if (!cacheKey) {
|
if (!cacheKey) {
|
||||||
core.info(`${packageManager} cache is not found`);
|
core.info(`${packageManager} cache is not found`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.saveState(constants_1.State.CacheMatchedKey, cacheKey);
|
core.saveState(constants_1.State.CacheMatchedKey, cacheKey);
|
||||||
core.info(`Cache restored from key: ${cacheKey}`);
|
core.info(`Cache restored from key: ${cacheKey}`);
|
||||||
});
|
});
|
||||||
const findLockFile = (packageManager) => {
|
const findLockFile = (packageManager) => {
|
||||||
let lockFiles = packageManager.lockFilePatterns;
|
let lockFiles = packageManager.lockFilePatterns;
|
||||||
const workspace = process.env.GITHUB_WORKSPACE;
|
const workspace = process.env.GITHUB_WORKSPACE;
|
||||||
const rootContent = fs_1.default.readdirSync(workspace);
|
const rootContent = fs_1.default.readdirSync(workspace);
|
||||||
const lockFile = lockFiles.find(item => rootContent.includes(item));
|
const lockFile = lockFiles.find(item => rootContent.includes(item));
|
||||||
if (!lockFile) {
|
if (!lockFile) {
|
||||||
throw new Error(`Dependencies lock file is not found in ${workspace}. Supported file patterns: ${lockFiles.toString()}`);
|
throw new Error(`Dependencies lock file is not found in ${workspace}. Supported file patterns: ${lockFiles.toString()}`);
|
||||||
}
|
}
|
||||||
return path_1.default.join(workspace, lockFile);
|
return path_1.default.join(workspace, lockFile);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -73011,109 +73011,109 @@ const findLockFile = (packageManager) => {
|
|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
exports.supportedPackageManagers = {
|
exports.supportedPackageManagers = {
|
||||||
npm: {
|
npm: {
|
||||||
lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
|
lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
|
||||||
getCacheFolderCommand: 'npm config get cache'
|
getCacheFolderCommand: 'npm config get cache'
|
||||||
},
|
},
|
||||||
pnpm: {
|
pnpm: {
|
||||||
lockFilePatterns: ['pnpm-lock.yaml'],
|
lockFilePatterns: ['pnpm-lock.yaml'],
|
||||||
getCacheFolderCommand: 'pnpm store path --silent'
|
getCacheFolderCommand: 'pnpm store path --silent'
|
||||||
},
|
},
|
||||||
yarn1: {
|
yarn1: {
|
||||||
lockFilePatterns: ['yarn.lock'],
|
lockFilePatterns: ['yarn.lock'],
|
||||||
getCacheFolderCommand: 'yarn cache dir'
|
getCacheFolderCommand: 'yarn cache dir'
|
||||||
},
|
},
|
||||||
yarn2: {
|
yarn2: {
|
||||||
lockFilePatterns: ['yarn.lock'],
|
lockFilePatterns: ['yarn.lock'],
|
||||||
getCacheFolderCommand: 'yarn config get cacheFolder'
|
getCacheFolderCommand: 'yarn config get cacheFolder'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
||||||
if (exitCode) {
|
if (exitCode) {
|
||||||
stderr = !stderr.trim()
|
stderr = !stderr.trim()
|
||||||
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
|
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
|
||||||
: stderr;
|
: stderr;
|
||||||
throw new Error(stderr);
|
throw new Error(stderr);
|
||||||
}
|
}
|
||||||
return stdout.trim();
|
return stdout.trim();
|
||||||
});
|
});
|
||||||
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
|
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
|
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
|
||||||
if (!stdOut) {
|
if (!stdOut) {
|
||||||
throw new Error(`Could not retrieve version of ${packageManager}`);
|
throw new Error(`Could not retrieve version of ${packageManager}`);
|
||||||
}
|
}
|
||||||
return stdOut;
|
return stdOut;
|
||||||
});
|
});
|
||||||
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (packageManager === 'npm') {
|
if (packageManager === 'npm') {
|
||||||
return exports.supportedPackageManagers.npm;
|
return exports.supportedPackageManagers.npm;
|
||||||
}
|
}
|
||||||
else if (packageManager === 'pnpm') {
|
else if (packageManager === 'pnpm') {
|
||||||
return exports.supportedPackageManagers.pnpm;
|
return exports.supportedPackageManagers.pnpm;
|
||||||
}
|
}
|
||||||
else if (packageManager === 'yarn') {
|
else if (packageManager === 'yarn') {
|
||||||
const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
|
const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
|
||||||
core.debug(`Consumed yarn version is ${yarnVersion}`);
|
core.debug(`Consumed yarn version is ${yarnVersion}`);
|
||||||
if (yarnVersion.startsWith('1.')) {
|
if (yarnVersion.startsWith('1.')) {
|
||||||
return exports.supportedPackageManagers.yarn1;
|
return exports.supportedPackageManagers.yarn1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return exports.supportedPackageManagers.yarn2;
|
return exports.supportedPackageManagers.yarn2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
||||||
if (!stdOut) {
|
if (!stdOut) {
|
||||||
throw new Error(`Could not get cache folder path for ${packageManager}`);
|
throw new Error(`Could not get cache folder path for ${packageManager}`);
|
||||||
}
|
}
|
||||||
core.debug(`${packageManager} path is ${stdOut}`);
|
core.debug(`${packageManager} path is ${stdOut}`);
|
||||||
return stdOut.trim();
|
return stdOut.trim();
|
||||||
});
|
});
|
||||||
function isGhes() {
|
function isGhes() {
|
||||||
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
||||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isCacheFeatureAvailable() {
|
function isCacheFeatureAvailable() {
|
||||||
if (!cache.isFeatureAvailable()) {
|
if (!cache.isFeatureAvailable()) {
|
||||||
if (isGhes()) {
|
if (isGhes()) {
|
||||||
throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
|
throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -73122,23 +73122,23 @@ exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
|||||||
/***/ ((__unused_webpack_module, exports) => {
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
var LockType;
|
var LockType;
|
||||||
(function (LockType) {
|
(function (LockType) {
|
||||||
LockType["Npm"] = "npm";
|
LockType["Npm"] = "npm";
|
||||||
LockType["Pnpm"] = "pnpm";
|
LockType["Pnpm"] = "pnpm";
|
||||||
LockType["Yarn"] = "yarn";
|
LockType["Yarn"] = "yarn";
|
||||||
})(LockType = exports.LockType || (exports.LockType = {}));
|
})(LockType = exports.LockType || (exports.LockType = {}));
|
||||||
var State;
|
var State;
|
||||||
(function (State) {
|
(function (State) {
|
||||||
State["CachePrimaryKey"] = "CACHE_KEY";
|
State["CachePrimaryKey"] = "CACHE_KEY";
|
||||||
State["CacheMatchedKey"] = "CACHE_RESULT";
|
State["CacheMatchedKey"] = "CACHE_RESULT";
|
||||||
})(State = exports.State || (exports.State = {}));
|
})(State = exports.State || (exports.State = {}));
|
||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
Outputs["CacheHit"] = "cache-hit";
|
Outputs["CacheHit"] = "cache-hit";
|
||||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -73147,414 +73147,414 @@ var Outputs;
|
|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const os = __nccwpck_require__(2037);
|
const os = __nccwpck_require__(2037);
|
||||||
const assert = __importStar(__nccwpck_require__(9491));
|
const assert = __importStar(__nccwpck_require__(9491));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const hc = __importStar(__nccwpck_require__(9925));
|
const hc = __importStar(__nccwpck_require__(9925));
|
||||||
const io = __importStar(__nccwpck_require__(7436));
|
const io = __importStar(__nccwpck_require__(7436));
|
||||||
const tc = __importStar(__nccwpck_require__(7784));
|
const tc = __importStar(__nccwpck_require__(7784));
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const semver = __importStar(__nccwpck_require__(5911));
|
const semver = __importStar(__nccwpck_require__(5911));
|
||||||
const fs = __nccwpck_require__(7147);
|
const fs = __nccwpck_require__(7147);
|
||||||
function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
|
function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Store manifest data to avoid multiple calls
|
// Store manifest data to avoid multiple calls
|
||||||
let manifest;
|
let manifest;
|
||||||
let nodeVersions;
|
let nodeVersions;
|
||||||
let osPlat = os.platform();
|
let osPlat = os.platform();
|
||||||
let osArch = translateArchToDistUrl(arch);
|
let osArch = translateArchToDistUrl(arch);
|
||||||
if (isLtsAlias(versionSpec)) {
|
if (isLtsAlias(versionSpec)) {
|
||||||
core.info('Attempt to resolve LTS alias from manifest...');
|
core.info('Attempt to resolve LTS alias from manifest...');
|
||||||
// No try-catch since it's not possible to resolve LTS alias without manifest
|
// No try-catch since it's not possible to resolve LTS alias without manifest
|
||||||
manifest = yield getManifest(auth);
|
manifest = yield getManifest(auth);
|
||||||
versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest);
|
versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest);
|
||||||
}
|
}
|
||||||
if (isLatestSyntax(versionSpec)) {
|
if (isLatestSyntax(versionSpec)) {
|
||||||
nodeVersions = yield getVersionsFromDist();
|
nodeVersions = yield getVersionsFromDist();
|
||||||
versionSpec = yield queryDistForMatch(versionSpec, arch, nodeVersions);
|
versionSpec = yield queryDistForMatch(versionSpec, arch, nodeVersions);
|
||||||
core.info(`getting latest node version...`);
|
core.info(`getting latest node version...`);
|
||||||
}
|
}
|
||||||
if (checkLatest) {
|
if (checkLatest) {
|
||||||
core.info('Attempt to resolve the latest version from manifest...');
|
core.info('Attempt to resolve the latest version from manifest...');
|
||||||
const resolvedVersion = yield resolveVersionFromManifest(versionSpec, stable, auth, osArch, manifest);
|
const resolvedVersion = yield resolveVersionFromManifest(versionSpec, stable, auth, osArch, manifest);
|
||||||
if (resolvedVersion) {
|
if (resolvedVersion) {
|
||||||
versionSpec = resolvedVersion;
|
versionSpec = resolvedVersion;
|
||||||
core.info(`Resolved as '${versionSpec}'`);
|
core.info(`Resolved as '${versionSpec}'`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(`Failed to resolve version ${versionSpec} from manifest`);
|
core.info(`Failed to resolve version ${versionSpec} from manifest`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check cache
|
// check cache
|
||||||
let toolPath;
|
let toolPath;
|
||||||
toolPath = tc.find('node', versionSpec, osArch);
|
toolPath = tc.find('node', versionSpec, osArch);
|
||||||
// If not found in cache, download
|
// If not found in cache, download
|
||||||
if (toolPath) {
|
if (toolPath) {
|
||||||
core.info(`Found in cache @ ${toolPath}`);
|
core.info(`Found in cache @ ${toolPath}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(`Attempting to download ${versionSpec}...`);
|
core.info(`Attempting to download ${versionSpec}...`);
|
||||||
let downloadPath = '';
|
let downloadPath = '';
|
||||||
let info = null;
|
let info = null;
|
||||||
//
|
//
|
||||||
// Try download from internal distribution (popular versions only)
|
// Try download from internal distribution (popular versions only)
|
||||||
//
|
//
|
||||||
try {
|
try {
|
||||||
info = yield getInfoFromManifest(versionSpec, stable, auth, osArch, manifest);
|
info = yield getInfoFromManifest(versionSpec, stable, auth, osArch, manifest);
|
||||||
if (info) {
|
if (info) {
|
||||||
core.info(`Acquiring ${info.resolvedVersion} - ${info.arch} from ${info.downloadUrl}`);
|
core.info(`Acquiring ${info.resolvedVersion} - ${info.arch} from ${info.downloadUrl}`);
|
||||||
downloadPath = yield tc.downloadTool(info.downloadUrl, undefined, auth);
|
downloadPath = yield tc.downloadTool(info.downloadUrl, undefined, auth);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info('Not found in manifest. Falling back to download directly from Node');
|
core.info('Not found in manifest. Falling back to download directly from Node');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
// Rate limit?
|
// Rate limit?
|
||||||
if (err instanceof tc.HTTPError &&
|
if (err instanceof tc.HTTPError &&
|
||||||
(err.httpStatusCode === 403 || err.httpStatusCode === 429)) {
|
(err.httpStatusCode === 403 || err.httpStatusCode === 429)) {
|
||||||
core.info(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
|
core.info(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(err.message);
|
core.info(err.message);
|
||||||
}
|
}
|
||||||
core.debug(err.stack);
|
core.debug(err.stack);
|
||||||
core.info('Falling back to download directly from Node');
|
core.info('Falling back to download directly from Node');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Download from nodejs.org
|
// Download from nodejs.org
|
||||||
//
|
//
|
||||||
if (!downloadPath) {
|
if (!downloadPath) {
|
||||||
info = yield getInfoFromDist(versionSpec, arch, nodeVersions);
|
info = yield getInfoFromDist(versionSpec, arch, nodeVersions);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`);
|
throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`);
|
||||||
}
|
}
|
||||||
core.info(`Acquiring ${info.resolvedVersion} - ${info.arch} from ${info.downloadUrl}`);
|
core.info(`Acquiring ${info.resolvedVersion} - ${info.arch} from ${info.downloadUrl}`);
|
||||||
try {
|
try {
|
||||||
downloadPath = yield tc.downloadTool(info.downloadUrl);
|
downloadPath = yield tc.downloadTool(info.downloadUrl);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
|
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
|
||||||
return yield acquireNodeFromFallbackLocation(info.resolvedVersion, info.arch);
|
return yield acquireNodeFromFallbackLocation(info.resolvedVersion, info.arch);
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Extract
|
// Extract
|
||||||
//
|
//
|
||||||
core.info('Extracting ...');
|
core.info('Extracting ...');
|
||||||
let extPath;
|
let extPath;
|
||||||
info = info || {}; // satisfy compiler, never null when reaches here
|
info = info || {}; // satisfy compiler, never null when reaches here
|
||||||
if (osPlat == 'win32') {
|
if (osPlat == 'win32') {
|
||||||
let _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe');
|
let _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe');
|
||||||
extPath = yield tc.extract7z(downloadPath, undefined, _7zPath);
|
extPath = yield tc.extract7z(downloadPath, undefined, _7zPath);
|
||||||
// 7z extracts to folder matching file name
|
// 7z extracts to folder matching file name
|
||||||
let nestedPath = path.join(extPath, path.basename(info.fileName, '.7z'));
|
let nestedPath = path.join(extPath, path.basename(info.fileName, '.7z'));
|
||||||
if (fs.existsSync(nestedPath)) {
|
if (fs.existsSync(nestedPath)) {
|
||||||
extPath = nestedPath;
|
extPath = nestedPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
extPath = yield tc.extractTar(downloadPath, undefined, [
|
extPath = yield tc.extractTar(downloadPath, undefined, [
|
||||||
'xz',
|
'xz',
|
||||||
'--strip',
|
'--strip',
|
||||||
'1'
|
'1'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
|
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
|
||||||
//
|
//
|
||||||
core.info('Adding to the cache ...');
|
core.info('Adding to the cache ...');
|
||||||
toolPath = yield tc.cacheDir(extPath, 'node', info.resolvedVersion, info.arch);
|
toolPath = yield tc.cacheDir(extPath, 'node', info.resolvedVersion, info.arch);
|
||||||
core.info('Done');
|
core.info('Done');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// a tool installer initimately knows details about the layout of that tool
|
// a tool installer initimately knows details about the layout of that tool
|
||||||
// for example, node binary is in the bin folder after the extract on Mac/Linux.
|
// for example, node binary is in the bin folder after the extract on Mac/Linux.
|
||||||
// layouts could change by version, by platform etc... but that's the tool installers job
|
// layouts could change by version, by platform etc... but that's the tool installers job
|
||||||
//
|
//
|
||||||
if (osPlat != 'win32') {
|
if (osPlat != 'win32') {
|
||||||
toolPath = path.join(toolPath, 'bin');
|
toolPath = path.join(toolPath, 'bin');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// prepend the tools path. instructs the agent to prepend for future tasks
|
// prepend the tools path. instructs the agent to prepend for future tasks
|
||||||
core.addPath(toolPath);
|
core.addPath(toolPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getNode = getNode;
|
exports.getNode = getNode;
|
||||||
function isLtsAlias(versionSpec) {
|
function isLtsAlias(versionSpec) {
|
||||||
return versionSpec.startsWith('lts/');
|
return versionSpec.startsWith('lts/');
|
||||||
}
|
}
|
||||||
function getManifest(auth) {
|
function getManifest(auth) {
|
||||||
core.debug('Getting manifest from actions/node-versions@main');
|
core.debug('Getting manifest from actions/node-versions@main');
|
||||||
return tc.getManifestFromRepo('actions', 'node-versions', auth, 'main');
|
return tc.getManifestFromRepo('actions', 'node-versions', auth, 'main');
|
||||||
}
|
}
|
||||||
function resolveLtsAliasFromManifest(versionSpec, stable, manifest) {
|
function resolveLtsAliasFromManifest(versionSpec, stable, manifest) {
|
||||||
var _a;
|
var _a;
|
||||||
const alias = (_a = versionSpec.split('lts/')[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
const alias = (_a = versionSpec.split('lts/')[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
||||||
if (!alias) {
|
if (!alias) {
|
||||||
throw new Error(`Unable to parse LTS alias for Node version '${versionSpec}'`);
|
throw new Error(`Unable to parse LTS alias for Node version '${versionSpec}'`);
|
||||||
}
|
}
|
||||||
core.debug(`LTS alias '${alias}' for Node version '${versionSpec}'`);
|
core.debug(`LTS alias '${alias}' for Node version '${versionSpec}'`);
|
||||||
// Supported formats are `lts/<alias>`, `lts/*`, and `lts/-n`. Where asterisk means highest possible LTS and -n means the nth-highest.
|
// Supported formats are `lts/<alias>`, `lts/*`, and `lts/-n`. Where asterisk means highest possible LTS and -n means the nth-highest.
|
||||||
const n = Number(alias);
|
const n = Number(alias);
|
||||||
const aliases = Object.fromEntries(manifest
|
const aliases = Object.fromEntries(manifest
|
||||||
.filter(x => x.lts && x.stable === stable)
|
.filter(x => x.lts && x.stable === stable)
|
||||||
.map(x => [x.lts.toLowerCase(), x])
|
.map(x => [x.lts.toLowerCase(), x])
|
||||||
.reverse());
|
.reverse());
|
||||||
const numbered = Object.values(aliases);
|
const numbered = Object.values(aliases);
|
||||||
const release = alias === '*'
|
const release = alias === '*'
|
||||||
? numbered[numbered.length - 1]
|
? numbered[numbered.length - 1]
|
||||||
: n < 0
|
: n < 0
|
||||||
? numbered[numbered.length - 1 + n]
|
? numbered[numbered.length - 1 + n]
|
||||||
: aliases[alias];
|
: aliases[alias];
|
||||||
if (!release) {
|
if (!release) {
|
||||||
throw new Error(`Unable to find LTS release '${alias}' for Node version '${versionSpec}'.`);
|
throw new Error(`Unable to find LTS release '${alias}' for Node version '${versionSpec}'.`);
|
||||||
}
|
}
|
||||||
core.debug(`Found LTS release '${release.version}' for Node version '${versionSpec}'`);
|
core.debug(`Found LTS release '${release.version}' for Node version '${versionSpec}'`);
|
||||||
return release.version.split('.')[0];
|
return release.version.split('.')[0];
|
||||||
}
|
}
|
||||||
function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchToDistUrl(os.arch()), manifest) {
|
function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchToDistUrl(os.arch()), manifest) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let info = null;
|
let info = null;
|
||||||
if (!manifest) {
|
if (!manifest) {
|
||||||
core.debug('No manifest cached');
|
core.debug('No manifest cached');
|
||||||
manifest = yield getManifest(auth);
|
manifest = yield getManifest(auth);
|
||||||
}
|
}
|
||||||
const rel = yield tc.findFromManifest(versionSpec, stable, manifest, osArch);
|
const rel = yield tc.findFromManifest(versionSpec, stable, manifest, osArch);
|
||||||
if (rel && rel.files.length > 0) {
|
if (rel && rel.files.length > 0) {
|
||||||
info = {};
|
info = {};
|
||||||
info.resolvedVersion = rel.version;
|
info.resolvedVersion = rel.version;
|
||||||
info.arch = rel.files[0].arch;
|
info.arch = rel.files[0].arch;
|
||||||
info.downloadUrl = rel.files[0].download_url;
|
info.downloadUrl = rel.files[0].download_url;
|
||||||
info.fileName = rel.files[0].filename;
|
info.fileName = rel.files[0].filename;
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getInfoFromDist(versionSpec, arch = os.arch(), nodeVersions) {
|
function getInfoFromDist(versionSpec, arch = os.arch(), nodeVersions) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let osPlat = os.platform();
|
let osPlat = os.platform();
|
||||||
let osArch = translateArchToDistUrl(arch);
|
let osArch = translateArchToDistUrl(arch);
|
||||||
let version = yield queryDistForMatch(versionSpec, arch, nodeVersions);
|
let version = yield queryDistForMatch(versionSpec, arch, nodeVersions);
|
||||||
if (!version) {
|
if (!version) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Download - a tool installer intimately knows how to get the tool (and construct urls)
|
// Download - a tool installer intimately knows how to get the tool (and construct urls)
|
||||||
//
|
//
|
||||||
version = semver.clean(version) || '';
|
version = semver.clean(version) || '';
|
||||||
let fileName = osPlat == 'win32'
|
let fileName = osPlat == 'win32'
|
||||||
? `node-v${version}-win-${osArch}`
|
? `node-v${version}-win-${osArch}`
|
||||||
: `node-v${version}-${osPlat}-${osArch}`;
|
: `node-v${version}-${osPlat}-${osArch}`;
|
||||||
let urlFileName = osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`;
|
let urlFileName = osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`;
|
||||||
let url = `https://nodejs.org/dist/v${version}/${urlFileName}`;
|
let url = `https://nodejs.org/dist/v${version}/${urlFileName}`;
|
||||||
return {
|
return {
|
||||||
downloadUrl: url,
|
downloadUrl: url,
|
||||||
resolvedVersion: version,
|
resolvedVersion: version,
|
||||||
arch: arch,
|
arch: arch,
|
||||||
fileName: fileName
|
fileName: fileName
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function resolveVersionFromManifest(versionSpec, stable, auth, osArch = translateArchToDistUrl(os.arch()), manifest) {
|
function resolveVersionFromManifest(versionSpec, stable, auth, osArch = translateArchToDistUrl(os.arch()), manifest) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const info = yield getInfoFromManifest(versionSpec, stable, auth, osArch, manifest);
|
const info = yield getInfoFromManifest(versionSpec, stable, auth, osArch, manifest);
|
||||||
return info === null || info === void 0 ? void 0 : info.resolvedVersion;
|
return info === null || info === void 0 ? void 0 : info.resolvedVersion;
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.info('Unable to resolve version from manifest...');
|
core.info('Unable to resolve version from manifest...');
|
||||||
core.debug(err.message);
|
core.debug(err.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// TODO - should we just export this from @actions/tool-cache? Lifted directly from there
|
// TODO - should we just export this from @actions/tool-cache? Lifted directly from there
|
||||||
function evaluateVersions(versions, versionSpec) {
|
function evaluateVersions(versions, versionSpec) {
|
||||||
let version = '';
|
let version = '';
|
||||||
core.debug(`evaluating ${versions.length} versions`);
|
core.debug(`evaluating ${versions.length} versions`);
|
||||||
versions = versions.sort((a, b) => {
|
versions = versions.sort((a, b) => {
|
||||||
if (semver.gt(a, b)) {
|
if (semver.gt(a, b)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
});
|
});
|
||||||
for (let i = versions.length - 1; i >= 0; i--) {
|
for (let i = versions.length - 1; i >= 0; i--) {
|
||||||
const potential = versions[i];
|
const potential = versions[i];
|
||||||
const satisfied = semver.satisfies(potential, versionSpec);
|
const satisfied = semver.satisfies(potential, versionSpec);
|
||||||
if (satisfied) {
|
if (satisfied) {
|
||||||
version = potential;
|
version = potential;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (version) {
|
if (version) {
|
||||||
core.debug(`matched: ${version}`);
|
core.debug(`matched: ${version}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.debug('match not found');
|
core.debug('match not found');
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
function queryDistForMatch(versionSpec, arch = os.arch(), nodeVersions) {
|
function queryDistForMatch(versionSpec, arch = os.arch(), nodeVersions) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let osPlat = os.platform();
|
let osPlat = os.platform();
|
||||||
let osArch = translateArchToDistUrl(arch);
|
let osArch = translateArchToDistUrl(arch);
|
||||||
// node offers a json list of versions
|
// node offers a json list of versions
|
||||||
let dataFileName;
|
let dataFileName;
|
||||||
switch (osPlat) {
|
switch (osPlat) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
dataFileName = `linux-${osArch}`;
|
dataFileName = `linux-${osArch}`;
|
||||||
break;
|
break;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
dataFileName = `osx-${osArch}-tar`;
|
dataFileName = `osx-${osArch}-tar`;
|
||||||
break;
|
break;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
dataFileName = `win-${osArch}-exe`;
|
dataFileName = `win-${osArch}-exe`;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unexpected OS '${osPlat}'`);
|
throw new Error(`Unexpected OS '${osPlat}'`);
|
||||||
}
|
}
|
||||||
if (!nodeVersions) {
|
if (!nodeVersions) {
|
||||||
core.debug('No dist manifest cached');
|
core.debug('No dist manifest cached');
|
||||||
nodeVersions = yield getVersionsFromDist();
|
nodeVersions = yield getVersionsFromDist();
|
||||||
}
|
}
|
||||||
let versions = [];
|
let versions = [];
|
||||||
if (isLatestSyntax(versionSpec)) {
|
if (isLatestSyntax(versionSpec)) {
|
||||||
core.info(`getting latest node version...`);
|
core.info(`getting latest node version...`);
|
||||||
return nodeVersions[0].version;
|
return nodeVersions[0].version;
|
||||||
}
|
}
|
||||||
nodeVersions.forEach((nodeVersion) => {
|
nodeVersions.forEach((nodeVersion) => {
|
||||||
// ensure this version supports your os and platform
|
// ensure this version supports your os and platform
|
||||||
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
|
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
|
||||||
versions.push(nodeVersion.version);
|
versions.push(nodeVersion.version);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// get the latest version that matches the version spec
|
// get the latest version that matches the version spec
|
||||||
let version = evaluateVersions(versions, versionSpec);
|
let version = evaluateVersions(versions, versionSpec);
|
||||||
return version;
|
return version;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getVersionsFromDist() {
|
function getVersionsFromDist() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let dataUrl = 'https://nodejs.org/dist/index.json';
|
let dataUrl = 'https://nodejs.org/dist/index.json';
|
||||||
let httpClient = new hc.HttpClient('setup-node', [], {
|
let httpClient = new hc.HttpClient('setup-node', [], {
|
||||||
allowRetries: true,
|
allowRetries: true,
|
||||||
maxRetries: 3
|
maxRetries: 3
|
||||||
});
|
});
|
||||||
let response = yield httpClient.getJson(dataUrl);
|
let response = yield httpClient.getJson(dataUrl);
|
||||||
return response.result || [];
|
return response.result || [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getVersionsFromDist = getVersionsFromDist;
|
exports.getVersionsFromDist = getVersionsFromDist;
|
||||||
// For non LTS versions of Node, the files we need (for Windows) are sometimes located
|
// For non LTS versions of Node, the files we need (for Windows) are sometimes located
|
||||||
// in a different folder than they normally are for other versions.
|
// in a different folder than they normally are for other versions.
|
||||||
// Normally the format is similar to: https://nodejs.org/dist/v5.10.1/node-v5.10.1-win-x64.7z
|
// Normally the format is similar to: https://nodejs.org/dist/v5.10.1/node-v5.10.1-win-x64.7z
|
||||||
// In this case, there will be two files located at:
|
// In this case, there will be two files located at:
|
||||||
// /dist/v5.10.1/win-x64/node.exe
|
// /dist/v5.10.1/win-x64/node.exe
|
||||||
// /dist/v5.10.1/win-x64/node.lib
|
// /dist/v5.10.1/win-x64/node.lib
|
||||||
// If this is not the structure, there may also be two files located at:
|
// If this is not the structure, there may also be two files located at:
|
||||||
// /dist/v0.12.18/node.exe
|
// /dist/v0.12.18/node.exe
|
||||||
// /dist/v0.12.18/node.lib
|
// /dist/v0.12.18/node.lib
|
||||||
// This method attempts to download and cache the resources from these alternative locations.
|
// This method attempts to download and cache the resources from these alternative locations.
|
||||||
// Note also that the files are normally zipped but in this case they are just an exe
|
// Note also that the files are normally zipped but in this case they are just an exe
|
||||||
// and lib file in a folder, not zipped.
|
// and lib file in a folder, not zipped.
|
||||||
function acquireNodeFromFallbackLocation(version, arch = os.arch()) {
|
function acquireNodeFromFallbackLocation(version, arch = os.arch()) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let osPlat = os.platform();
|
let osPlat = os.platform();
|
||||||
let osArch = translateArchToDistUrl(arch);
|
let osArch = translateArchToDistUrl(arch);
|
||||||
// Create temporary folder to download in to
|
// Create temporary folder to download in to
|
||||||
const tempDownloadFolder = 'temp_' + Math.floor(Math.random() * 2000000000);
|
const tempDownloadFolder = 'temp_' + Math.floor(Math.random() * 2000000000);
|
||||||
const tempDirectory = process.env['RUNNER_TEMP'] || '';
|
const tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||||
assert.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
|
assert.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
|
||||||
const tempDir = path.join(tempDirectory, tempDownloadFolder);
|
const tempDir = path.join(tempDirectory, tempDownloadFolder);
|
||||||
yield io.mkdirP(tempDir);
|
yield io.mkdirP(tempDir);
|
||||||
let exeUrl;
|
let exeUrl;
|
||||||
let libUrl;
|
let libUrl;
|
||||||
try {
|
try {
|
||||||
exeUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.exe`;
|
exeUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.exe`;
|
||||||
libUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.lib`;
|
libUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.lib`;
|
||||||
core.info(`Downloading only node binary from ${exeUrl}`);
|
core.info(`Downloading only node binary from ${exeUrl}`);
|
||||||
const exePath = yield tc.downloadTool(exeUrl);
|
const exePath = yield tc.downloadTool(exeUrl);
|
||||||
yield io.cp(exePath, path.join(tempDir, 'node.exe'));
|
yield io.cp(exePath, path.join(tempDir, 'node.exe'));
|
||||||
const libPath = yield tc.downloadTool(libUrl);
|
const libPath = yield tc.downloadTool(libUrl);
|
||||||
yield io.cp(libPath, path.join(tempDir, 'node.lib'));
|
yield io.cp(libPath, path.join(tempDir, 'node.lib'));
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
|
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
|
||||||
exeUrl = `https://nodejs.org/dist/v${version}/node.exe`;
|
exeUrl = `https://nodejs.org/dist/v${version}/node.exe`;
|
||||||
libUrl = `https://nodejs.org/dist/v${version}/node.lib`;
|
libUrl = `https://nodejs.org/dist/v${version}/node.lib`;
|
||||||
const exePath = yield tc.downloadTool(exeUrl);
|
const exePath = yield tc.downloadTool(exeUrl);
|
||||||
yield io.cp(exePath, path.join(tempDir, 'node.exe'));
|
yield io.cp(exePath, path.join(tempDir, 'node.exe'));
|
||||||
const libPath = yield tc.downloadTool(libUrl);
|
const libPath = yield tc.downloadTool(libUrl);
|
||||||
yield io.cp(libPath, path.join(tempDir, 'node.lib'));
|
yield io.cp(libPath, path.join(tempDir, 'node.lib'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let toolPath = yield tc.cacheDir(tempDir, 'node', version, arch);
|
let toolPath = yield tc.cacheDir(tempDir, 'node', version, arch);
|
||||||
core.addPath(toolPath);
|
core.addPath(toolPath);
|
||||||
return toolPath;
|
return toolPath;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// os.arch does not always match the relative download url, e.g.
|
// os.arch does not always match the relative download url, e.g.
|
||||||
// os.arch == 'arm' != node-v12.13.1-linux-armv7l.tar.gz
|
// os.arch == 'arm' != node-v12.13.1-linux-armv7l.tar.gz
|
||||||
// All other currently supported architectures match, e.g.:
|
// All other currently supported architectures match, e.g.:
|
||||||
// os.arch = arm64 => https://nodejs.org/dist/v{VERSION}/node-v{VERSION}-{OS}-arm64.tar.gz
|
// os.arch = arm64 => https://nodejs.org/dist/v{VERSION}/node-v{VERSION}-{OS}-arm64.tar.gz
|
||||||
// os.arch = x64 => https://nodejs.org/dist/v{VERSION}/node-v{VERSION}-{OS}-x64.tar.gz
|
// os.arch = x64 => https://nodejs.org/dist/v{VERSION}/node-v{VERSION}-{OS}-x64.tar.gz
|
||||||
function translateArchToDistUrl(arch) {
|
function translateArchToDistUrl(arch) {
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
case 'arm':
|
case 'arm':
|
||||||
return 'armv7l';
|
return 'armv7l';
|
||||||
default:
|
default:
|
||||||
return arch;
|
return arch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function parseNodeVersionFile(contents) {
|
function parseNodeVersionFile(contents) {
|
||||||
var _a, _b, _c;
|
var _a, _b, _c;
|
||||||
let nodeVersion;
|
let nodeVersion;
|
||||||
// Try parsing the file as an NPM `package.json` file.
|
// Try parsing the file as an NPM `package.json` file.
|
||||||
try {
|
try {
|
||||||
nodeVersion = (_a = JSON.parse(contents).volta) === null || _a === void 0 ? void 0 : _a.node;
|
nodeVersion = (_a = JSON.parse(contents).volta) === null || _a === void 0 ? void 0 : _a.node;
|
||||||
if (!nodeVersion)
|
if (!nodeVersion)
|
||||||
nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
|
nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
|
||||||
}
|
}
|
||||||
catch (_d) {
|
catch (_d) {
|
||||||
core.warning('Node version file is not JSON file');
|
core.info('Node version file is not JSON file');
|
||||||
}
|
}
|
||||||
if (!nodeVersion) {
|
if (!nodeVersion) {
|
||||||
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
|
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
|
||||||
nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
|
nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
|
||||||
}
|
}
|
||||||
// In the case of an unknown format,
|
// In the case of an unknown format,
|
||||||
// return as is and evaluate the version separately.
|
// return as is and evaluate the version separately.
|
||||||
if (!nodeVersion)
|
if (!nodeVersion)
|
||||||
nodeVersion = contents.trim();
|
nodeVersion = contents.trim();
|
||||||
return nodeVersion;
|
return nodeVersion;
|
||||||
}
|
}
|
||||||
exports.parseNodeVersionFile = parseNodeVersionFile;
|
exports.parseNodeVersionFile = parseNodeVersionFile;
|
||||||
function isLatestSyntax(versionSpec) {
|
function isLatestSyntax(versionSpec) {
|
||||||
return ['current', 'latest', 'node'].includes(versionSpec);
|
return ['current', 'latest', 'node'].includes(versionSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -73563,108 +73563,108 @@ function isLatestSyntax(versionSpec) {
|
|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
const installer = __importStar(__nccwpck_require__(2574));
|
const installer = __importStar(__nccwpck_require__(2574));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const auth = __importStar(__nccwpck_require__(7573));
|
const auth = __importStar(__nccwpck_require__(7573));
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const cache_restore_1 = __nccwpck_require__(9517);
|
const cache_restore_1 = __nccwpck_require__(9517);
|
||||||
const cache_utils_1 = __nccwpck_require__(1678);
|
const cache_utils_1 = __nccwpck_require__(1678);
|
||||||
const os = __nccwpck_require__(2037);
|
const os = __nccwpck_require__(2037);
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
//
|
//
|
||||||
// Version is optional. If supplied, install / use from the tool cache
|
// Version is optional. If supplied, install / use from the tool cache
|
||||||
// If not supplied then task is still used to setup proxy, auth, etc...
|
// If not supplied then task is still used to setup proxy, auth, etc...
|
||||||
//
|
//
|
||||||
let version = resolveVersionInput();
|
let version = resolveVersionInput();
|
||||||
let arch = core.getInput('architecture');
|
let arch = core.getInput('architecture');
|
||||||
const cache = core.getInput('cache');
|
const cache = core.getInput('cache');
|
||||||
// if architecture supplied but node-version is not
|
// if architecture supplied but node-version is not
|
||||||
// if we don't throw a warning, the already installed x64 node will be used which is not probably what user meant.
|
// if we don't throw a warning, the already installed x64 node will be used which is not probably what user meant.
|
||||||
if (arch && !version) {
|
if (arch && !version) {
|
||||||
core.warning('`architecture` is provided but `node-version` is missing. In this configuration, the version/architecture of Node will not be changed. To fix this, provide `architecture` in combination with `node-version`');
|
core.warning('`architecture` is provided but `node-version` is missing. In this configuration, the version/architecture of Node will not be changed. To fix this, provide `architecture` in combination with `node-version`');
|
||||||
}
|
}
|
||||||
if (!arch) {
|
if (!arch) {
|
||||||
arch = os.arch();
|
arch = os.arch();
|
||||||
}
|
}
|
||||||
if (version) {
|
if (version) {
|
||||||
let token = core.getInput('token');
|
let token = core.getInput('token');
|
||||||
let auth = !token || cache_utils_1.isGhes() ? undefined : `token ${token}`;
|
let auth = !token || cache_utils_1.isGhes() ? undefined : `token ${token}`;
|
||||||
let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
|
let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
|
||||||
const checkLatest = (core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE';
|
const checkLatest = (core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE';
|
||||||
yield installer.getNode(version, stable, checkLatest, auth, arch);
|
yield installer.getNode(version, stable, checkLatest, auth, arch);
|
||||||
}
|
}
|
||||||
// Output version of node is being used
|
// Output version of node is being used
|
||||||
try {
|
try {
|
||||||
const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true, silent: true });
|
const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true, silent: true });
|
||||||
core.setOutput('node-version', installedVersion.trim());
|
core.setOutput('node-version', installedVersion.trim());
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.setOutput('node-version', '');
|
core.setOutput('node-version', '');
|
||||||
}
|
}
|
||||||
const registryUrl = core.getInput('registry-url');
|
const registryUrl = core.getInput('registry-url');
|
||||||
const alwaysAuth = core.getInput('always-auth');
|
const alwaysAuth = core.getInput('always-auth');
|
||||||
if (registryUrl) {
|
if (registryUrl) {
|
||||||
auth.configAuthentication(registryUrl, alwaysAuth);
|
auth.configAuthentication(registryUrl, alwaysAuth);
|
||||||
}
|
}
|
||||||
if (cache && cache_utils_1.isCacheFeatureAvailable()) {
|
if (cache && cache_utils_1.isCacheFeatureAvailable()) {
|
||||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||||
yield cache_restore_1.restoreCache(cache, cacheDependencyPath);
|
yield cache_restore_1.restoreCache(cache, cacheDependencyPath);
|
||||||
}
|
}
|
||||||
const matchersPath = path.join(__dirname, '../..', '.github');
|
const matchersPath = path.join(__dirname, '../..', '.github');
|
||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'tsc.json')}`);
|
core.info(`##[add-matcher]${path.join(matchersPath, 'tsc.json')}`);
|
||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'eslint-stylish.json')}`);
|
core.info(`##[add-matcher]${path.join(matchersPath, 'eslint-stylish.json')}`);
|
||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`);
|
core.info(`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.setFailed(err.message);
|
core.setFailed(err.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
function resolveVersionInput() {
|
function resolveVersionInput() {
|
||||||
let version = core.getInput('node-version');
|
let version = core.getInput('node-version');
|
||||||
const versionFileInput = core.getInput('node-version-file');
|
const versionFileInput = core.getInput('node-version-file');
|
||||||
if (version && versionFileInput) {
|
if (version && versionFileInput) {
|
||||||
core.warning('Both node-version and node-version-file inputs are specified, only node-version will be used');
|
core.warning('Both node-version and node-version-file inputs are specified, only node-version will be used');
|
||||||
}
|
}
|
||||||
if (version) {
|
if (version) {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
if (versionFileInput) {
|
if (versionFileInput) {
|
||||||
const versionFilePath = path.join(process.env.GITHUB_WORKSPACE, versionFileInput);
|
const versionFilePath = path.join(process.env.GITHUB_WORKSPACE, versionFileInput);
|
||||||
if (!fs_1.default.existsSync(versionFilePath)) {
|
if (!fs_1.default.existsSync(versionFilePath)) {
|
||||||
throw new Error(`The specified node version file at: ${versionFilePath} does not exist`);
|
throw new Error(`The specified node version file at: ${versionFilePath} does not exist`);
|
||||||
}
|
}
|
||||||
version = installer.parseNodeVersionFile(fs_1.default.readFileSync(versionFilePath, 'utf8'));
|
version = installer.parseNodeVersionFile(fs_1.default.readFileSync(versionFilePath, 'utf8'));
|
||||||
core.info(`Resolved ${versionFileInput} as ${version}`);
|
core.info(`Resolved ${versionFileInput} as ${version}`);
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -73920,10 +73920,10 @@ var __webpack_exports__ = {};
|
|||||||
(() => {
|
(() => {
|
||||||
"use strict";
|
"use strict";
|
||||||
var exports = __webpack_exports__;
|
var exports = __webpack_exports__;
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const main_1 = __nccwpck_require__(399);
|
const main_1 = __nccwpck_require__(399);
|
||||||
main_1.run();
|
main_1.run();
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
@ -502,7 +502,7 @@ export function parseNodeVersionFile(contents: string): string {
|
|||||||
nodeVersion = JSON.parse(contents).volta?.node;
|
nodeVersion = JSON.parse(contents).volta?.node;
|
||||||
if (!nodeVersion) nodeVersion = JSON.parse(contents).engines?.node;
|
if (!nodeVersion) nodeVersion = JSON.parse(contents).engines?.node;
|
||||||
} catch {
|
} catch {
|
||||||
core.warning('Node version file is not JSON file');
|
core.info('Node version file is not JSON file');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nodeVersion) {
|
if (!nodeVersion) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user