mirror of
https://github.com/actions/setup-node.git
synced 2025-02-26 17:45:50 +00:00
update mirrorURL versions
This commit is contained in:
parent
50efbd2a86
commit
91a5e5da06
131
dist/setup/index.js
vendored
131
dist/setup/index.js
vendored
@ -100154,6 +100154,14 @@ class BaseDistribution {
|
|||||||
return response.result || [];
|
return response.result || [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
getMirrorUrVersions() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const initialUrl = this.getDistributionMirrorUrl();
|
||||||
|
const dataUrl = `${initialUrl}/index.json`;
|
||||||
|
const response = yield this.httpClient.getJson(dataUrl);
|
||||||
|
return response.result || [];
|
||||||
|
});
|
||||||
|
}
|
||||||
getNodejsDistInfo(version) {
|
getNodejsDistInfo(version) {
|
||||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||||
version = semver_1.default.clean(version) || '';
|
version = semver_1.default.clean(version) || '';
|
||||||
@ -100165,7 +100173,7 @@ class BaseDistribution {
|
|||||||
? `${fileName}.zip`
|
? `${fileName}.zip`
|
||||||
: `${fileName}.7z`
|
: `${fileName}.7z`
|
||||||
: `${fileName}.tar.gz`;
|
: `${fileName}.tar.gz`;
|
||||||
const initialUrl = this.getDistributionUrl();
|
const initialUrl = this.getDistributionMirrorUrl();
|
||||||
const url = `${initialUrl}/v${version}/${urlFileName}`;
|
const url = `${initialUrl}/v${version}/${urlFileName}`;
|
||||||
return {
|
return {
|
||||||
downloadUrl: url,
|
downloadUrl: url,
|
||||||
@ -100406,17 +100414,54 @@ exports.getNodejsDistribution = getNodejsDistribution;
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(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) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
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 base_distribution_prerelease_1 = __importDefault(__nccwpck_require__(957));
|
const base_distribution_prerelease_1 = __importDefault(__nccwpck_require__(957));
|
||||||
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
class NightlyNodejs extends base_distribution_prerelease_1.default {
|
class NightlyNodejs extends base_distribution_prerelease_1.default {
|
||||||
constructor(nodeInfo) {
|
constructor(nodeInfo) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
this.distribution = 'nightly';
|
this.distribution = 'nightly';
|
||||||
}
|
}
|
||||||
|
getDistributionMirrorUrl() {
|
||||||
|
// Implement the method to return the mirror URL or an empty string if not available
|
||||||
|
return this.nodeInfo.mirrorURL || '';
|
||||||
|
}
|
||||||
|
// Updated getDistributionUrl method to handle mirror URL or fallback
|
||||||
getDistributionUrl() {
|
getDistributionUrl() {
|
||||||
|
// Check if mirrorUrl exists in the nodeInfo and return it if available
|
||||||
|
const mirrorUrl = this.nodeInfo.mirrorURL;
|
||||||
|
if (mirrorUrl) {
|
||||||
|
core.info(`Using mirror URL: ${mirrorUrl}`);
|
||||||
|
return mirrorUrl;
|
||||||
|
}
|
||||||
|
// Default to the official Node.js nightly distribution URL if no mirror URL is provided
|
||||||
|
core.info('Using default distribution URL for nightly Node.js.');
|
||||||
return 'https://nodejs.org/download/nightly';
|
return 'https://nodejs.org/download/nightly';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100603,6 +100648,13 @@ class OfficialBuilds extends base_distribution_1.default {
|
|||||||
getDistributionUrl() {
|
getDistributionUrl() {
|
||||||
return `https://nodejs.org/dist`;
|
return `https://nodejs.org/dist`;
|
||||||
}
|
}
|
||||||
|
getDistributionMirrorUrl() {
|
||||||
|
const mirrorURL = this.nodeInfo.mirrorURL;
|
||||||
|
if (!mirrorURL) {
|
||||||
|
throw new Error('Mirror URL is undefined');
|
||||||
|
}
|
||||||
|
return mirrorURL;
|
||||||
|
}
|
||||||
getManifest() {
|
getManifest() {
|
||||||
core.debug('Getting manifest from actions/node-versions@main');
|
core.debug('Getting manifest from actions/node-versions@main');
|
||||||
return tc.getManifestFromRepo('actions', 'node-versions', this.nodeInfo.auth, 'main');
|
return tc.getManifestFromRepo('actions', 'node-versions', this.nodeInfo.auth, 'main');
|
||||||
@ -100670,17 +100722,9 @@ class OfficialBuilds extends base_distribution_1.default {
|
|||||||
}
|
}
|
||||||
downloadFromMirrorURL() {
|
downloadFromMirrorURL() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const nodeJsVersions = yield this.getNodeJsVersions();
|
const nodeJsVersions = yield this.getMirrorUrVersions();
|
||||||
core.info('versions from nodeJSVersions' + nodeJsVersions);
|
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
const versions = this.filterVersions(nodeJsVersions);
|
||||||
core.info('versions' + versions);
|
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
const evaluatedVersion = this.evaluateVersions(versions);
|
||||||
core.info('versionSpec' + this.nodeInfo.versionSpec);
|
|
||||||
if (this.nodeInfo.checkLatest) {
|
|
||||||
const evaluatedVersion = yield this.findVersionInDist(nodeJsVersions);
|
|
||||||
this.nodeInfo.versionSpec = evaluatedVersion;
|
|
||||||
core.info('versionSpec' + this.nodeInfo.versionSpec);
|
|
||||||
}
|
|
||||||
if (!evaluatedVersion) {
|
if (!evaluatedVersion) {
|
||||||
throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`);
|
throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`);
|
||||||
}
|
}
|
||||||
@ -100714,11 +100758,35 @@ exports["default"] = OfficialBuilds;
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(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) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
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 base_distribution_1 = __importDefault(__nccwpck_require__(7));
|
const base_distribution_1 = __importDefault(__nccwpck_require__(7));
|
||||||
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
class RcBuild extends base_distribution_1.default {
|
class RcBuild extends base_distribution_1.default {
|
||||||
constructor(nodeInfo) {
|
constructor(nodeInfo) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
@ -100726,6 +100794,16 @@ class RcBuild extends base_distribution_1.default {
|
|||||||
getDistributionUrl() {
|
getDistributionUrl() {
|
||||||
return 'https://nodejs.org/download/rc';
|
return 'https://nodejs.org/download/rc';
|
||||||
}
|
}
|
||||||
|
getDistributionMirrorUrl() {
|
||||||
|
// Check if mirrorUrl exists in the nodeInfo and return it if available
|
||||||
|
const mirrorUrl = this.nodeInfo.mirrorURL;
|
||||||
|
if (mirrorUrl) {
|
||||||
|
core.info(`Using mirror URL: ${mirrorUrl}`);
|
||||||
|
return mirrorUrl;
|
||||||
|
}
|
||||||
|
// Return the default URL if no mirror URL is provided
|
||||||
|
return this.getDistributionUrl();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports["default"] = RcBuild;
|
exports["default"] = RcBuild;
|
||||||
|
|
||||||
@ -100737,11 +100815,35 @@ exports["default"] = RcBuild;
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(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) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
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 base_distribution_prerelease_1 = __importDefault(__nccwpck_require__(957));
|
const base_distribution_prerelease_1 = __importDefault(__nccwpck_require__(957));
|
||||||
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
class CanaryBuild extends base_distribution_prerelease_1.default {
|
class CanaryBuild extends base_distribution_prerelease_1.default {
|
||||||
constructor(nodeInfo) {
|
constructor(nodeInfo) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
@ -100750,6 +100852,15 @@ class CanaryBuild extends base_distribution_prerelease_1.default {
|
|||||||
getDistributionUrl() {
|
getDistributionUrl() {
|
||||||
return 'https://nodejs.org/download/v8-canary';
|
return 'https://nodejs.org/download/v8-canary';
|
||||||
}
|
}
|
||||||
|
getDistributionMirrorUrl() {
|
||||||
|
// Check if mirrorUrl exists in the nodeInfo and return it if available
|
||||||
|
const mirrorUrl = this.nodeInfo.mirrorURL;
|
||||||
|
if (mirrorUrl) {
|
||||||
|
core.info(`Using mirror URL: ${mirrorUrl}`);
|
||||||
|
return mirrorUrl;
|
||||||
|
}
|
||||||
|
return 'https://nodejs.org/download/v8-canary';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports["default"] = CanaryBuild;
|
exports["default"] = CanaryBuild;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ export default abstract class BaseDistribution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract getDistributionUrl(): string;
|
protected abstract getDistributionUrl(): string;
|
||||||
|
protected abstract getDistributionMirrorUrl(): string;
|
||||||
|
|
||||||
public async setupNodeJs() {
|
public async setupNodeJs() {
|
||||||
let nodeJsVersions: INodeVersion[] | undefined;
|
let nodeJsVersions: INodeVersion[] | undefined;
|
||||||
@ -105,6 +105,14 @@ export default abstract class BaseDistribution {
|
|||||||
return response.result || [];
|
return response.result || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async getMirrorUrVersions(): Promise<INodeVersion[]> {
|
||||||
|
const initialUrl = this.getDistributionMirrorUrl();
|
||||||
|
const dataUrl = `${initialUrl}/index.json`;
|
||||||
|
|
||||||
|
const response = await this.httpClient.getJson<INodeVersion[]>(dataUrl);
|
||||||
|
return response.result || [];
|
||||||
|
}
|
||||||
|
|
||||||
protected getNodejsDistInfo(version: string) {
|
protected getNodejsDistInfo(version: string) {
|
||||||
const osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch);
|
const osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||||
version = semver.clean(version) || '';
|
version = semver.clean(version) || '';
|
||||||
@ -118,7 +126,7 @@ export default abstract class BaseDistribution {
|
|||||||
? `${fileName}.zip`
|
? `${fileName}.zip`
|
||||||
: `${fileName}.7z`
|
: `${fileName}.7z`
|
||||||
: `${fileName}.tar.gz`;
|
: `${fileName}.tar.gz`;
|
||||||
const initialUrl = this.getDistributionUrl();
|
const initialUrl = this.getDistributionMirrorUrl();
|
||||||
const url = `${initialUrl}/v${version}/${urlFileName}`;
|
const url = `${initialUrl}/v${version}/${urlFileName}`;
|
||||||
|
|
||||||
return <INodeVersionInfo>{
|
return <INodeVersionInfo>{
|
||||||
@ -173,7 +181,9 @@ export default abstract class BaseDistribution {
|
|||||||
info.downloadUrl
|
info.downloadUrl
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
core.error(`Download failed from ${info.downloadUrl}. Please check the URl and try again.`);
|
core.error(
|
||||||
|
`Download failed from ${info.downloadUrl}. Please check the URl and try again.`
|
||||||
|
);
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@ -195,7 +205,7 @@ export default abstract class BaseDistribution {
|
|||||||
protected async acquireWindowsNodeFromFallbackLocation(
|
protected async acquireWindowsNodeFromFallbackLocation(
|
||||||
version: string,
|
version: string,
|
||||||
arch: string = os.arch(),
|
arch: string = os.arch(),
|
||||||
downloadUrl : string
|
downloadUrl: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const initialUrl = this.getDistributionUrl();
|
const initialUrl = this.getDistributionUrl();
|
||||||
core.info('url: ' + initialUrl);
|
core.info('url: ' + initialUrl);
|
||||||
@ -214,8 +224,12 @@ export default abstract class BaseDistribution {
|
|||||||
libUrl = `${initialUrl}/v${version}/win-${osArch}/node.lib`;
|
libUrl = `${initialUrl}/v${version}/win-${osArch}/node.lib`;
|
||||||
|
|
||||||
core.info(`Downloading only node binary from ${exeUrl}`);
|
core.info(`Downloading only node binary from ${exeUrl}`);
|
||||||
if(downloadUrl != exeUrl ){core.error('unable to download node binary with the provided URL. Please check and try again');}
|
|
||||||
|
|
||||||
|
if (downloadUrl != exeUrl) {
|
||||||
|
core.error(
|
||||||
|
'unable to download node binary with the provided URL. Please check and try again'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const exePath = await tc.downloadTool(exeUrl);
|
const exePath = await tc.downloadTool(exeUrl);
|
||||||
await io.cp(exePath, path.join(tempDir, 'node.exe'));
|
await io.cp(exePath, path.join(tempDir, 'node.exe'));
|
||||||
|
@ -4,7 +4,7 @@ export interface NodeInputs {
|
|||||||
auth?: string;
|
auth?: string;
|
||||||
checkLatest: boolean;
|
checkLatest: boolean;
|
||||||
stable: boolean;
|
stable: boolean;
|
||||||
mirrorURL: string;
|
mirrorURL?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INodeVersionInfo {
|
export interface INodeVersionInfo {
|
||||||
@ -12,7 +12,6 @@ export interface INodeVersionInfo {
|
|||||||
resolvedVersion: string;
|
resolvedVersion: string;
|
||||||
arch: string;
|
arch: string;
|
||||||
fileName: string;
|
fileName: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INodeVersion {
|
export interface INodeVersion {
|
||||||
|
@ -1,13 +1,31 @@
|
|||||||
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
||||||
import {NodeInputs} from '../base-models';
|
import {NodeInputs} from '../base-models';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
export default class NightlyNodejs extends BasePrereleaseNodejs {
|
export default class NightlyNodejs extends BasePrereleaseNodejs {
|
||||||
|
|
||||||
protected distribution = 'nightly';
|
protected distribution = 'nightly';
|
||||||
|
|
||||||
constructor(nodeInfo: NodeInputs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getDistributionMirrorUrl(): string {
|
||||||
|
// Implement the method to return the mirror URL or an empty string if not available
|
||||||
|
return this.nodeInfo.mirrorURL || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Updated getDistributionUrl method to handle mirror URL or fallback
|
||||||
protected getDistributionUrl(): string {
|
protected getDistributionUrl(): string {
|
||||||
|
// Check if mirrorUrl exists in the nodeInfo and return it if available
|
||||||
|
const mirrorUrl = this.nodeInfo.mirrorURL;
|
||||||
|
if (mirrorUrl) {
|
||||||
|
core.info(`Using mirror URL: ${mirrorUrl}`);
|
||||||
|
return mirrorUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default to the official Node.js nightly distribution URL if no mirror URL is provided
|
||||||
|
core.info('Using default distribution URL for nightly Node.js.');
|
||||||
return 'https://nodejs.org/download/nightly';
|
return 'https://nodejs.org/download/nightly';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,10 @@ interface INodeRelease extends tc.IToolRelease {
|
|||||||
export default class OfficialBuilds extends BaseDistribution {
|
export default class OfficialBuilds extends BaseDistribution {
|
||||||
constructor(nodeInfo: NodeInputs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async setupNodeJs() {
|
public async setupNodeJs() {
|
||||||
if(this.nodeInfo.mirrorURL){
|
if (this.nodeInfo.mirrorURL) {
|
||||||
|
|
||||||
let downloadPath = '';
|
let downloadPath = '';
|
||||||
let toolPath = '';
|
let toolPath = '';
|
||||||
try {
|
try {
|
||||||
@ -31,8 +28,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
core.info((err as Error).message);
|
core.info((err as Error).message);
|
||||||
core.debug((err as Error).stack ?? 'empty stack');
|
core.debug((err as Error).stack ?? 'empty stack');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
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);
|
||||||
@ -143,8 +139,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
|
|
||||||
core.addPath(toolPath);
|
core.addPath(toolPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected addToolPath(toolPath: string) {
|
protected addToolPath(toolPath: string) {
|
||||||
if (this.osPlat != 'win32') {
|
if (this.osPlat != 'win32') {
|
||||||
@ -200,6 +195,13 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
return `https://nodejs.org/dist`;
|
return `https://nodejs.org/dist`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getDistributionMirrorUrl(): string {
|
||||||
|
const mirrorURL = this.nodeInfo.mirrorURL;
|
||||||
|
if (!mirrorURL) {
|
||||||
|
throw new Error('Mirror URL is undefined');
|
||||||
|
}
|
||||||
|
return mirrorURL;
|
||||||
|
}
|
||||||
|
|
||||||
private getManifest(): Promise<tc.IToolRelease[]> {
|
private getManifest(): Promise<tc.IToolRelease[]> {
|
||||||
core.debug('Getting manifest from actions/node-versions@main');
|
core.debug('Getting manifest from actions/node-versions@main');
|
||||||
@ -314,20 +316,10 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async downloadFromMirrorURL() {
|
protected async downloadFromMirrorURL() {
|
||||||
const nodeJsVersions = await this.getNodeJsVersions();
|
const nodeJsVersions = await this.getMirrorUrVersions();
|
||||||
core.info('versions from nodeJSVersions'+nodeJsVersions);
|
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
const versions = this.filterVersions(nodeJsVersions);
|
||||||
core.info('versions'+versions);
|
|
||||||
|
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
const evaluatedVersion = this.evaluateVersions(versions);
|
||||||
core.info('versionSpec'+this.nodeInfo.versionSpec);
|
|
||||||
|
|
||||||
if (this.nodeInfo.checkLatest) {
|
|
||||||
const evaluatedVersion = await this.findVersionInDist(nodeJsVersions);
|
|
||||||
this.nodeInfo.versionSpec = evaluatedVersion;
|
|
||||||
core.info('versionSpec'+this.nodeInfo.versionSpec);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!evaluatedVersion) {
|
if (!evaluatedVersion) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@ -355,5 +347,4 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import BaseDistribution from '../base-distribution';
|
import BaseDistribution from '../base-distribution';
|
||||||
import {NodeInputs} from '../base-models';
|
import {NodeInputs} from '../base-models';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
export default class RcBuild extends BaseDistribution {
|
export default class RcBuild extends BaseDistribution {
|
||||||
|
|
||||||
constructor(nodeInfo: NodeInputs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
}
|
}
|
||||||
@ -9,4 +11,16 @@ export default class RcBuild extends BaseDistribution {
|
|||||||
getDistributionUrl(): string {
|
getDistributionUrl(): string {
|
||||||
return 'https://nodejs.org/download/rc';
|
return 'https://nodejs.org/download/rc';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getDistributionMirrorUrl(): string {
|
||||||
|
// Check if mirrorUrl exists in the nodeInfo and return it if available
|
||||||
|
const mirrorUrl = this.nodeInfo.mirrorURL;
|
||||||
|
if (mirrorUrl) {
|
||||||
|
core.info(`Using mirror URL: ${mirrorUrl}`);
|
||||||
|
return mirrorUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the default URL if no mirror URL is provided
|
||||||
|
return this.getDistributionUrl();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
||||||
import {NodeInputs} from '../base-models';
|
import {NodeInputs} from '../base-models';
|
||||||
|
import * as core from '@actions/core';
|
||||||
export default class CanaryBuild extends BasePrereleaseNodejs {
|
export default class CanaryBuild extends BasePrereleaseNodejs {
|
||||||
|
|
||||||
protected distribution = 'v8-canary';
|
protected distribution = 'v8-canary';
|
||||||
constructor(nodeInfo: NodeInputs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
@ -10,4 +11,14 @@ export default class CanaryBuild extends BasePrereleaseNodejs {
|
|||||||
protected getDistributionUrl(): string {
|
protected getDistributionUrl(): string {
|
||||||
return 'https://nodejs.org/download/v8-canary';
|
return 'https://nodejs.org/download/v8-canary';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getDistributionMirrorUrl(): string {
|
||||||
|
// Check if mirrorUrl exists in the nodeInfo and return it if available
|
||||||
|
const mirrorUrl = this.nodeInfo.mirrorURL;
|
||||||
|
if (mirrorUrl) {
|
||||||
|
core.info(`Using mirror URL: ${mirrorUrl}`);
|
||||||
|
return mirrorUrl;
|
||||||
|
}
|
||||||
|
return 'https://nodejs.org/download/v8-canary';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ export async function run() {
|
|||||||
|
|
||||||
const mirrorURL = core.getInput('mirror-url').trim(); // .trim() to remove any accidental spaces
|
const mirrorURL = core.getInput('mirror-url').trim(); // .trim() to remove any accidental spaces
|
||||||
|
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
const token = core.getInput('token');
|
const token = core.getInput('token');
|
||||||
const auth = !token ? undefined : `token ${token}`;
|
const auth = !token ? undefined : `token ${token}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user