mirror of
				https://kkgithub.com/actions/setup-node.git
				synced 2025-11-04 20:51:59 +08:00 
			
		
		
		
	feat: add arch to getInfoFromDist
This commit is contained in:
		@ -97,7 +97,7 @@ export async function getNode(
 | 
				
			|||||||
    // Download from nodejs.org
 | 
					    // Download from nodejs.org
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    if (!downloadPath) {
 | 
					    if (!downloadPath) {
 | 
				
			||||||
      info = await getInfoFromDist(versionSpec);
 | 
					      info = await getInfoFromDist(versionSpec, arch);
 | 
				
			||||||
      if (!info) {
 | 
					      if (!info) {
 | 
				
			||||||
        throw new Error(
 | 
					        throw new Error(
 | 
				
			||||||
          `Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`
 | 
					          `Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`
 | 
				
			||||||
@ -192,10 +192,11 @@ async function getInfoFromManifest(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getInfoFromDist(
 | 
					async function getInfoFromDist(
 | 
				
			||||||
  versionSpec: string
 | 
					  versionSpec: string,
 | 
				
			||||||
 | 
					  arch: string = os.arch()
 | 
				
			||||||
): Promise<INodeVersionInfo | null> {
 | 
					): Promise<INodeVersionInfo | null> {
 | 
				
			||||||
  let osPlat: string = os.platform();
 | 
					  let osPlat: string = os.platform();
 | 
				
			||||||
  let osArch: string = translateArchToDistUrl(os.arch());
 | 
					  let osArch: string = translateArchToDistUrl(arch);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let version: string;
 | 
					  let version: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -219,6 +220,7 @@ async function getInfoFromDist(
 | 
				
			|||||||
  return <INodeVersionInfo>{
 | 
					  return <INodeVersionInfo>{
 | 
				
			||||||
    downloadUrl: url,
 | 
					    downloadUrl: url,
 | 
				
			||||||
    resolvedVersion: version,
 | 
					    resolvedVersion: version,
 | 
				
			||||||
 | 
					    arch: osArch,
 | 
				
			||||||
    fileName: fileName
 | 
					    fileName: fileName
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user