mirror of
https://github.com/actions/setup-node.git
synced 2024-12-23 09:06:38 +08:00
feat: add arch to getInfoFromManifest
This commit is contained in:
parent
3e84c3523b
commit
6afbfca452
|
@ -66,7 +66,7 @@ export async function getNode(
|
||||||
// Try download from internal distribution (popular versions only)
|
// Try download from internal distribution (popular versions only)
|
||||||
//
|
//
|
||||||
try {
|
try {
|
||||||
info = await getInfoFromManifest(versionSpec, stable, auth);
|
info = await getInfoFromManifest(versionSpec, stable, auth, osArch);
|
||||||
if (info) {
|
if (info) {
|
||||||
core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
|
core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
|
||||||
downloadPath = await tc.downloadTool(info.downloadUrl, undefined, auth);
|
downloadPath = await tc.downloadTool(info.downloadUrl, undefined, auth);
|
||||||
|
@ -161,7 +161,8 @@ export async function getNode(
|
||||||
async function getInfoFromManifest(
|
async function getInfoFromManifest(
|
||||||
versionSpec: string,
|
versionSpec: string,
|
||||||
stable: boolean,
|
stable: boolean,
|
||||||
auth: string | undefined
|
auth: string | undefined,
|
||||||
|
osArch: string = translateArchToDistUrl(os.arch())
|
||||||
): Promise<INodeVersionInfo | null> {
|
): Promise<INodeVersionInfo | null> {
|
||||||
let info: INodeVersionInfo | null = null;
|
let info: INodeVersionInfo | null = null;
|
||||||
const releases = await tc.getManifestFromRepo(
|
const releases = await tc.getManifestFromRepo(
|
||||||
|
@ -170,11 +171,12 @@ async function getInfoFromManifest(
|
||||||
auth,
|
auth,
|
||||||
'main'
|
'main'
|
||||||
);
|
);
|
||||||
const rel = await tc.findFromManifest(versionSpec, stable, releases);
|
const rel = await tc.findFromManifest(versionSpec, stable, releases, osArch);
|
||||||
|
|
||||||
if (rel && rel.files.length > 0) {
|
if (rel && rel.files.length > 0) {
|
||||||
info = <INodeVersionInfo>{};
|
info = <INodeVersionInfo>{};
|
||||||
info.resolvedVersion = rel.version;
|
info.resolvedVersion = rel.version;
|
||||||
|
info.arch = rel.files[0].arch;
|
||||||
info.downloadUrl = rel.files[0].download_url;
|
info.downloadUrl = rel.files[0].download_url;
|
||||||
info.fileName = rel.files[0].filename;
|
info.fileName = rel.files[0].filename;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +223,7 @@ async function resolveVersionFromManifest(
|
||||||
osArch: string = translateArchToDistUrl(os.arch())
|
osArch: string = translateArchToDistUrl(os.arch())
|
||||||
): Promise<string | undefined> {
|
): Promise<string | undefined> {
|
||||||
try {
|
try {
|
||||||
const info = await getInfoFromManifest(versionSpec, stable, auth);
|
const info = await getInfoFromManifest(versionSpec, stable, auth, osArch);
|
||||||
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...');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user