revert some changes

This commit is contained in:
Dmitry Shibanov 2022-12-29 11:17:34 +01:00
parent eec2a7e0d8
commit 0631b1d444
4 changed files with 18 additions and 9 deletions

15
dist/setup/index.js vendored
View file

@ -73693,7 +73693,7 @@ class OfficialBuilds extends base_distribution_1.default {
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 this.getManifest(); manifest = yield this.getManifest();
this.nodeInfo.versionSpec = this.resolveLtsAliasFromManifest(this.nodeInfo.versionSpec, true, manifest); this.nodeInfo.versionSpec = this.resolveLtsAliasFromManifest(this.nodeInfo.versionSpec, this.nodeInfo.stable, manifest);
} }
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) { if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
nodeJsVersions = yield this.getNodeJsVersions(); nodeJsVersions = yield this.getNodeJsVersions();
@ -73703,7 +73703,7 @@ class OfficialBuilds extends base_distribution_1.default {
} }
if (this.nodeInfo.checkLatest) { if (this.nodeInfo.checkLatest) {
core.info('Attempt to resolve the latest version from manifest...'); core.info('Attempt to resolve the latest version from manifest...');
const resolvedVersion = yield this.resolveVersionFromManifest(this.nodeInfo.versionSpec, osArch, manifest); const resolvedVersion = yield this.resolveVersionFromManifest(this.nodeInfo.versionSpec, this.nodeInfo.stable, osArch, manifest);
if (resolvedVersion) { if (resolvedVersion) {
this.nodeInfo.versionSpec = resolvedVersion; this.nodeInfo.versionSpec = resolvedVersion;
core.info(`Resolved as '${resolvedVersion}'`); core.info(`Resolved as '${resolvedVersion}'`);
@ -73720,7 +73720,7 @@ class OfficialBuilds extends base_distribution_1.default {
let downloadPath = ''; let downloadPath = '';
try { try {
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`); core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
const versionInfo = yield this.getInfoFromManifest(this.nodeInfo.versionSpec, osArch, manifest); const versionInfo = yield this.getInfoFromManifest(this.nodeInfo.versionSpec, this.nodeInfo.stable, osArch, manifest);
if (versionInfo) { if (versionInfo) {
core.info(`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`); core.info(`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`);
downloadPath = yield tc.downloadTool(versionInfo.downloadUrl, undefined, this.nodeInfo.auth); downloadPath = yield tc.downloadTool(versionInfo.downloadUrl, undefined, this.nodeInfo.auth);
@ -73802,10 +73802,10 @@ class OfficialBuilds extends base_distribution_1.default {
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];
} }
resolveVersionFromManifest(versionSpec, osArch, manifest) { resolveVersionFromManifest(versionSpec, stable, osArch, manifest) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
const info = yield this.getInfoFromManifest(versionSpec, osArch, manifest); const info = yield this.getInfoFromManifest(versionSpec, stable, 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) {
@ -73814,9 +73814,8 @@ class OfficialBuilds extends base_distribution_1.default {
} }
}); });
} }
getInfoFromManifest(versionSpec, osArch, manifest) { getInfoFromManifest(versionSpec, stable, osArch, manifest) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const stable = true;
let info = null; let info = null;
if (!manifest) { if (!manifest) {
core.debug('No manifest cached'); core.debug('No manifest cached');
@ -73960,11 +73959,13 @@ function run() {
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}`;
const 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';
const nodejsInfo = { const nodejsInfo = {
versionSpec: version, versionSpec: version,
checkLatest, checkLatest,
auth, auth,
stable,
arch arch
}; };
const nodeDistribution = installer_factory_1.getNodejsDistribution(nodejsInfo); const nodeDistribution = installer_factory_1.getNodejsDistribution(nodejsInfo);

View file

@ -3,6 +3,7 @@ export interface NodeInputs {
arch: string; arch: string;
auth?: string; auth?: string;
checkLatest: boolean; checkLatest: boolean;
stable: boolean;
} }
export interface INodeVersionInfo { export interface INodeVersionInfo {

View file

@ -26,7 +26,7 @@ export default class OfficialBuilds extends BaseDistribution {
this.nodeInfo.versionSpec = this.resolveLtsAliasFromManifest( this.nodeInfo.versionSpec = this.resolveLtsAliasFromManifest(
this.nodeInfo.versionSpec, this.nodeInfo.versionSpec,
true, this.nodeInfo.stable,
manifest manifest
); );
} }
@ -43,6 +43,7 @@ export default class OfficialBuilds extends BaseDistribution {
core.info('Attempt to resolve the latest version from manifest...'); core.info('Attempt to resolve the latest version from manifest...');
const resolvedVersion = await this.resolveVersionFromManifest( const resolvedVersion = await this.resolveVersionFromManifest(
this.nodeInfo.versionSpec, this.nodeInfo.versionSpec,
this.nodeInfo.stable,
osArch, osArch,
manifest manifest
); );
@ -67,6 +68,7 @@ export default class OfficialBuilds extends BaseDistribution {
const versionInfo = await this.getInfoFromManifest( const versionInfo = await this.getInfoFromManifest(
this.nodeInfo.versionSpec, this.nodeInfo.versionSpec,
this.nodeInfo.stable,
osArch, osArch,
manifest manifest
); );
@ -198,12 +200,14 @@ export default class OfficialBuilds extends BaseDistribution {
private async resolveVersionFromManifest( private async resolveVersionFromManifest(
versionSpec: string, versionSpec: string,
stable: boolean,
osArch: string, osArch: string,
manifest: tc.IToolRelease[] | undefined manifest: tc.IToolRelease[] | undefined
): Promise<string | undefined> { ): Promise<string | undefined> {
try { try {
const info = await this.getInfoFromManifest( const info = await this.getInfoFromManifest(
versionSpec, versionSpec,
stable,
osArch, osArch,
manifest manifest
); );
@ -216,10 +220,10 @@ export default class OfficialBuilds extends BaseDistribution {
private async getInfoFromManifest( private async getInfoFromManifest(
versionSpec: string, versionSpec: string,
stable: boolean,
osArch: string, osArch: string,
manifest: tc.IToolRelease[] | undefined manifest: tc.IToolRelease[] | undefined
): Promise<INodeVersionInfo | null> { ): Promise<INodeVersionInfo | null> {
const stable = true;
let info: INodeVersionInfo | null = null; let info: INodeVersionInfo | null = null;
if (!manifest) { if (!manifest) {
core.debug('No manifest cached'); core.debug('No manifest cached');

View file

@ -36,12 +36,15 @@ export async function run() {
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}`;
const stable =
(core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
const checkLatest = const checkLatest =
(core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE'; (core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE';
const nodejsInfo = { const nodejsInfo = {
versionSpec: version, versionSpec: version,
checkLatest, checkLatest,
auth, auth,
stable,
arch arch
}; };
const nodeDistribution = getNodejsDistribution(nodejsInfo); const nodeDistribution = getNodejsDistribution(nodejsInfo);