Compare commits
No commits in common. "main" and "v3" have entirely different histories.
|
|
@ -1,9 +1,9 @@
|
||||||
---
|
---
|
||||||
name: semver
|
name: semver
|
||||||
version: 5.7.2
|
version: 5.7.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: The semantic version parser used by npm.
|
summary: The semantic version parser used by npm.
|
||||||
homepage:
|
homepage: https://github.com/npm/node-semver#readme
|
||||||
license: isc
|
license: isc
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
name: signal-exit
|
name: signal-exit
|
||||||
version: 3.0.7
|
version: 3.0.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: when you want to fire an event no matter how a process exits.
|
summary: when you want to fire an event no matter how a process exits.
|
||||||
homepage: https://github.com/tapjs/signal-exit
|
homepage: https://github.com/tapjs/signal-exit
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
---
|
||||||
|
name: uuid
|
||||||
|
version: 3.3.2
|
||||||
|
type: npm
|
||||||
|
summary: RFC4122 (v1, v4, and v5) UUIDs
|
||||||
|
homepage: https://github.com/kelektiv/node-uuid#readme
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE.md
|
||||||
|
text: |
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2010-2016 Robert Kieffer and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
notices:
|
||||||
|
- sources: AUTHORS
|
||||||
|
text: |-
|
||||||
|
Robert Kieffer <robert@broofa.com>
|
||||||
|
Christoph Tavan <dev@tavan.de>
|
||||||
|
AJ ONeal <coolaj86@gmail.com>
|
||||||
|
Vincent Voyer <vincent@zeroload.net>
|
||||||
|
Roman Shtylman <shtylman@gmail.com>
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
---
|
|
||||||
name: uuid
|
|
||||||
version: 9.0.0
|
|
||||||
type: npm
|
|
||||||
summary: RFC4122 (v1, v4, and v5) UUIDs
|
|
||||||
homepage:
|
|
||||||
license: mit
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE.md
|
|
||||||
text: |
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
notices: []
|
|
||||||
|
|
@ -357,41 +357,6 @@ describe('setup-node', () => {
|
||||||
expect(cnSpy).toHaveBeenCalledWith(`::error::${errMsg}${osm.EOL}`);
|
expect(cnSpy).toHaveBeenCalledWith(`::error::${errMsg}${osm.EOL}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reports when download failed but version exists', async () => {
|
|
||||||
os.platform = 'linux';
|
|
||||||
os.arch = 'x64';
|
|
||||||
|
|
||||||
// a version which is not in the manifest but is in node dist
|
|
||||||
const versionSpec = '11.15.0';
|
|
||||||
|
|
||||||
inputs['node-version'] = versionSpec;
|
|
||||||
inputs['always-auth'] = false;
|
|
||||||
inputs['token'] = 'faketoken';
|
|
||||||
|
|
||||||
// ... but not in the local cache
|
|
||||||
findSpy.mockImplementation(() => '');
|
|
||||||
|
|
||||||
dlSpy.mockImplementationOnce(async () => {
|
|
||||||
throw new tc.HTTPError(404);
|
|
||||||
});
|
|
||||||
|
|
||||||
await main.run();
|
|
||||||
|
|
||||||
expect(getManifestSpy).toHaveBeenCalled();
|
|
||||||
expect(logSpy).toHaveBeenCalledWith(
|
|
||||||
`Attempting to download ${versionSpec}...`
|
|
||||||
);
|
|
||||||
expect(logSpy).toHaveBeenCalledWith(
|
|
||||||
'Not found in manifest. Falling back to download directly from Node'
|
|
||||||
);
|
|
||||||
expect(dlSpy).toHaveBeenCalled();
|
|
||||||
expect(warningSpy).toHaveBeenCalledWith(
|
|
||||||
`Node version ${versionSpec} for platform ${os.platform} and architecture ${os.arch} was found but failed to download. ` +
|
|
||||||
'This usually happens when downloadable binaries are not fully updated at https://nodejs.org/. ' +
|
|
||||||
'To resolve this issue you may either fall back to the older version or try again later.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('acquires specified architecture of node', async () => {
|
it('acquires specified architecture of node', async () => {
|
||||||
for (const {arch, version, osSpec} of [
|
for (const {arch, version, osSpec} of [
|
||||||
{arch: 'x86', version: '12.16.2', osSpec: 'win32'},
|
{arch: 'x86', version: '12.16.2', osSpec: 'win32'},
|
||||||
|
|
|
||||||
|
|
@ -60335,11 +60335,7 @@ exports.debug = debug; // for test
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
||||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
||||||
}
|
|
||||||
Object.defineProperty(o, k2, desc);
|
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
|
@ -60394,7 +60390,7 @@ const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, func
|
||||||
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 cachePaths = JSON.parse(core.getState(constants_1.State.CachePaths) || '[]');
|
const cachePaths = JSON.parse(core.getState(constants_1.State.CachePaths) || '[]');
|
||||||
const packageManagerInfo = yield (0, 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;
|
||||||
|
|
@ -60427,11 +60423,7 @@ run();
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
||||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
||||||
}
|
|
||||||
Object.defineProperty(o, k2, desc);
|
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
|
@ -60473,22 +60465,22 @@ exports.supportedPackageManagers = {
|
||||||
npm: {
|
npm: {
|
||||||
name: 'npm',
|
name: 'npm',
|
||||||
lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
|
lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
|
||||||
getCacheFolderPath: () => (0, exports.getCommandOutputNotEmpty)('npm config get cache', 'Could not get npm cache folder path')
|
getCacheFolderPath: () => exports.getCommandOutputNotEmpty('npm config get cache', 'Could not get npm cache folder path')
|
||||||
},
|
},
|
||||||
pnpm: {
|
pnpm: {
|
||||||
name: 'pnpm',
|
name: 'pnpm',
|
||||||
lockFilePatterns: ['pnpm-lock.yaml'],
|
lockFilePatterns: ['pnpm-lock.yaml'],
|
||||||
getCacheFolderPath: () => (0, exports.getCommandOutputNotEmpty)('pnpm store path --silent', 'Could not get pnpm cache folder path')
|
getCacheFolderPath: () => exports.getCommandOutputNotEmpty('pnpm store path --silent', 'Could not get pnpm cache folder path')
|
||||||
},
|
},
|
||||||
yarn: {
|
yarn: {
|
||||||
name: 'yarn',
|
name: 'yarn',
|
||||||
lockFilePatterns: ['yarn.lock'],
|
lockFilePatterns: ['yarn.lock'],
|
||||||
getCacheFolderPath: (projectDir) => __awaiter(void 0, void 0, void 0, function* () {
|
getCacheFolderPath: (projectDir) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const yarnVersion = yield (0, exports.getCommandOutputNotEmpty)(`yarn --version`, 'Could not retrieve version of yarn', projectDir);
|
const yarnVersion = yield exports.getCommandOutputNotEmpty(`yarn --version`, 'Could not retrieve version of yarn', projectDir);
|
||||||
core.debug(`Consumed yarn version is ${yarnVersion} (working dir: "${projectDir || ''}")`);
|
core.debug(`Consumed yarn version is ${yarnVersion} (working dir: "${projectDir || ''}")`);
|
||||||
const stdOut = yarnVersion.startsWith('1.')
|
const stdOut = yarnVersion.startsWith('1.')
|
||||||
? yield (0, exports.getCommandOutput)('yarn cache dir', projectDir)
|
? yield exports.getCommandOutput('yarn cache dir', projectDir)
|
||||||
: yield (0, exports.getCommandOutput)('yarn config get cacheFolder', projectDir);
|
: yield exports.getCommandOutput('yarn config get cacheFolder', projectDir);
|
||||||
if (!stdOut) {
|
if (!stdOut) {
|
||||||
throw new Error(`Could not get yarn cache folder path for ${projectDir}`);
|
throw new Error(`Could not get yarn cache folder path for ${projectDir}`);
|
||||||
}
|
}
|
||||||
|
|
@ -60508,7 +60500,7 @@ const getCommandOutput = (toolCommand, cwd) => __awaiter(void 0, void 0, void 0,
|
||||||
});
|
});
|
||||||
exports.getCommandOutput = getCommandOutput;
|
exports.getCommandOutput = getCommandOutput;
|
||||||
const getCommandOutputNotEmpty = (toolCommand, error, cwd) => __awaiter(void 0, void 0, void 0, function* () {
|
const getCommandOutputNotEmpty = (toolCommand, error, cwd) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const stdOut = (0, exports.getCommandOutput)(toolCommand, cwd);
|
const stdOut = exports.getCommandOutput(toolCommand, cwd);
|
||||||
if (!stdOut) {
|
if (!stdOut) {
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
|
|
@ -60558,7 +60550,7 @@ const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __
|
||||||
const cacheDependenciesPaths = yield globber.glob();
|
const cacheDependenciesPaths = yield globber.glob();
|
||||||
const existingDirectories = cacheDependenciesPaths
|
const existingDirectories = cacheDependenciesPaths
|
||||||
.map(path_1.default.dirname)
|
.map(path_1.default.dirname)
|
||||||
.filter((0, util_1.unique)())
|
.filter(util_1.unique())
|
||||||
.map(dirName => fs_1.default.realpathSync(dirName))
|
.map(dirName => fs_1.default.realpathSync(dirName))
|
||||||
.filter(directory => fs_1.default.lstatSync(directory).isDirectory());
|
.filter(directory => fs_1.default.lstatSync(directory).isDirectory());
|
||||||
if (!existingDirectories.length)
|
if (!existingDirectories.length)
|
||||||
|
|
@ -60581,7 +60573,7 @@ const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDep
|
||||||
return cacheFolderPath;
|
return cacheFolderPath;
|
||||||
})));
|
})));
|
||||||
// uniq in order to do not cache the same directories twice
|
// uniq in order to do not cache the same directories twice
|
||||||
return cacheFoldersPaths.filter((0, util_1.unique)());
|
return cacheFoldersPaths.filter(util_1.unique());
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* Finds the cache directories configured for the repo ignoring cache-dependency-path
|
* Finds the cache directories configured for the repo ignoring cache-dependency-path
|
||||||
|
|
@ -60631,7 +60623,7 @@ const projectHasYarnBerryManagedDependencies = (directory) => __awaiter(void 0,
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
// NOTE: yarn1 returns 'undefined' with return code = 0
|
// NOTE: yarn1 returns 'undefined' with return code = 0
|
||||||
const enableGlobalCache = yield (0, exports.getCommandOutput)('yarn config get enableGlobalCache', workDir);
|
const enableGlobalCache = yield exports.getCommandOutput('yarn config get enableGlobalCache', workDir);
|
||||||
// only local cache is not managed by yarn
|
// only local cache is not managed by yarn
|
||||||
const managed = enableGlobalCache.includes('false');
|
const managed = enableGlobalCache.includes('false');
|
||||||
if (managed) {
|
if (managed) {
|
||||||
|
|
@ -60715,11 +60707,7 @@ var Outputs;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
||||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
||||||
}
|
|
||||||
Object.defineProperty(o, k2, desc);
|
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
|
|
@ -33,26 +33,24 @@
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^1.0.11",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^1.5.4",
|
"@actions/tool-cache": "^1.5.4",
|
||||||
"semver": "^6.3.1",
|
"semver": "^6.3.1"
|
||||||
"uuid": "^9.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.6",
|
"@types/jest": "^27.0.2",
|
||||||
"@types/node": "^16.11.25",
|
"@types/node": "^16.11.25",
|
||||||
"@types/semver": "^6.0.0",
|
"@types/semver": "^6.0.0",
|
||||||
"@types/uuid": "^9.0.3",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
||||||
"@typescript-eslint/parser": "^5.54.0",
|
"@typescript-eslint/parser": "^5.54.0",
|
||||||
"@vercel/ncc": "^0.38.0",
|
"@vercel/ncc": "^0.33.4",
|
||||||
"eslint": "^8.35.0",
|
"eslint": "^8.35.0",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
"eslint-plugin-jest": "^27.2.1",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^27.2.5",
|
||||||
"jest-circus": "^29.7.0",
|
"jest-circus": "^27.2.5",
|
||||||
"jest-each": "^29.7.0",
|
"jest-each": "^27.2.5",
|
||||||
"prettier": "^2.8.4",
|
"prettier": "^2.8.4",
|
||||||
"ts-jest": "^29.1.1",
|
"ts-jest": "^27.0.5",
|
||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export async function run() {
|
||||||
const cacheLock = core.getState(State.CachePackageManager);
|
const cacheLock = core.getState(State.CachePackageManager);
|
||||||
await cachePackages(cacheLock);
|
await cachePackages(cacheLock);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed((error as Error).message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import {v4 as uuidv4} from 'uuid';
|
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import * as hc from '@actions/http-client';
|
import * as hc from '@actions/http-client';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
@ -167,8 +166,9 @@ export default abstract class BaseDistribution {
|
||||||
const initialUrl = this.getDistributionUrl();
|
const initialUrl = this.getDistributionUrl();
|
||||||
const osArch: string = this.translateArchToDistUrl(arch);
|
const osArch: string = this.translateArchToDistUrl(arch);
|
||||||
|
|
||||||
// Create temporary folder to download to
|
// Create temporary folder to download in to
|
||||||
const tempDownloadFolder = `temp_${uuidv4()}`;
|
const tempDownloadFolder: string =
|
||||||
|
'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: string = path.join(tempDirectory, tempDownloadFolder);
|
const tempDir: string = path.join(tempDirectory, tempDownloadFolder);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||||
let manifest: tc.IToolRelease[] | undefined;
|
let manifest: tc.IToolRelease[] | undefined;
|
||||||
let nodeJsVersions: INodeVersion[] | undefined;
|
let nodeJsVersions: INodeVersion[] | undefined;
|
||||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||||
|
|
||||||
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
||||||
core.info('Attempt to resolve LTS alias from manifest...');
|
core.info('Attempt to resolve LTS alias from manifest...');
|
||||||
|
|
||||||
|
|
@ -62,10 +61,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||||
|
|
||||||
if (toolPath) {
|
if (toolPath) {
|
||||||
core.info(`Found in cache @ ${toolPath}`);
|
core.info(`Found in cache @ ${toolPath}`);
|
||||||
this.addToolPath(toolPath);
|
} else {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let downloadPath = '';
|
let downloadPath = '';
|
||||||
try {
|
try {
|
||||||
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
||||||
|
|
@ -76,7 +72,6 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||||
osArch,
|
osArch,
|
||||||
manifest
|
manifest
|
||||||
);
|
);
|
||||||
|
|
||||||
if (versionInfo) {
|
if (versionInfo) {
|
||||||
core.info(
|
core.info(
|
||||||
`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`
|
`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`
|
||||||
|
|
@ -105,58 +100,31 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||||
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
core.info((err as Error).message);
|
core.info(err.message);
|
||||||
}
|
}
|
||||||
core.debug((err as Error).stack ?? 'empty stack');
|
core.debug(err.stack);
|
||||||
core.info('Falling back to download directly from Node');
|
core.info('Falling back to download directly from Node');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!toolPath) {
|
if (!toolPath) {
|
||||||
toolPath = await this.downloadDirectlyFromNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.osPlat != 'win32') {
|
|
||||||
toolPath = path.join(toolPath, 'bin');
|
|
||||||
}
|
|
||||||
|
|
||||||
core.addPath(toolPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected addToolPath(toolPath: string) {
|
|
||||||
if (this.osPlat != 'win32') {
|
|
||||||
toolPath = path.join(toolPath, 'bin');
|
|
||||||
}
|
|
||||||
|
|
||||||
core.addPath(toolPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async downloadDirectlyFromNode() {
|
|
||||||
const nodeJsVersions = await this.getNodeJsVersions();
|
const nodeJsVersions = await this.getNodeJsVersions();
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
const versions = this.filterVersions(nodeJsVersions);
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
const evaluatedVersion = this.evaluateVersions(versions);
|
||||||
|
|
||||||
if (!evaluatedVersion) {
|
if (!evaluatedVersion) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
|
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
||||||
|
toolPath = await this.downloadNodejs(toolName);
|
||||||
try {
|
}
|
||||||
const toolPath = await this.downloadNodejs(toolName);
|
|
||||||
return toolPath;
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof tc.HTTPError && error.httpStatusCode === 404) {
|
|
||||||
core.warning(
|
|
||||||
`Node version ${this.nodeInfo.versionSpec} for platform ${this.osPlat} and architecture ${this.nodeInfo.arch} was found but failed to download. ` +
|
|
||||||
'This usually happens when downloadable binaries are not fully updated at https://nodejs.org/. ' +
|
|
||||||
'To resolve this issue you may either fall back to the older version or try again later.'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw error;
|
if (this.osPlat != 'win32') {
|
||||||
|
toolPath = path.join(toolPath, 'bin');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.addPath(toolPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected evaluateVersions(versions: string[]): string {
|
protected evaluateVersions(versions: string[]): string {
|
||||||
|
|
@ -246,7 +214,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
||||||
return info?.resolvedVersion;
|
return 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 as Error).message);
|
core.debug(err.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ export async function run() {
|
||||||
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
|
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.setFailed((err as Error).message);
|
core.setFailed(err.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue