From 6afbfca452be9589ed60a1b9ee0e914b8534679c Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Thu, 3 Sep 2020 07:34:03 -0500 Subject: [PATCH] feat: add arch to getInfoFromManifest --- src/installer.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index 22c8953a..1f2731ce 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -66,7 +66,7 @@ export async function getNode( // Try download from internal distribution (popular versions only) // try { - info = await getInfoFromManifest(versionSpec, stable, auth); + info = await getInfoFromManifest(versionSpec, stable, auth, osArch); if (info) { core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`); downloadPath = await tc.downloadTool(info.downloadUrl, undefined, auth); @@ -161,7 +161,8 @@ export async function getNode( async function getInfoFromManifest( versionSpec: string, stable: boolean, - auth: string | undefined + auth: string | undefined, + osArch: string = translateArchToDistUrl(os.arch()) ): Promise { let info: INodeVersionInfo | null = null; const releases = await tc.getManifestFromRepo( @@ -170,11 +171,12 @@ async function getInfoFromManifest( auth, 'main' ); - const rel = await tc.findFromManifest(versionSpec, stable, releases); + const rel = await tc.findFromManifest(versionSpec, stable, releases, osArch); if (rel && rel.files.length > 0) { info = {}; info.resolvedVersion = rel.version; + info.arch = rel.files[0].arch; info.downloadUrl = rel.files[0].download_url; info.fileName = rel.files[0].filename; } @@ -221,7 +223,7 @@ async function resolveVersionFromManifest( osArch: string = translateArchToDistUrl(os.arch()) ): Promise { try { - const info = await getInfoFromManifest(versionSpec, stable, auth); + const info = await getInfoFromManifest(versionSpec, stable, auth, osArch); return info?.resolvedVersion; } catch (err) { core.info('Unable to resolve version from manifest...');