diff --git a/dist/setup/index.js b/dist/setup/index.js index 0f9cf0e9a..04c53eeeb 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63484,11 +63484,17 @@ function resolveStableVersionInput(versionSpec, auth, arch = os_1.default.arch() return __awaiter(this, void 0, void 0, function* () { if (!manifest) { core.debug('No manifest cached'); - manifest = (yield getManifest(auth)); + manifest = yield getManifest(auth); } const releases = manifest - .filter(release => !!release.files.find(file => file.arch === arch)) - .map(release => release.version); + .map(item => { + const index = item.files.findIndex(item => item.arch === arch); + if (index === -1) { + return ''; + } + return item.version; + }) + .filter(item => !!item); if (versionSpec === utils_1.StableReleaseAlias.Stable) { core.info(`stable version resolved as ${releases[0]}`); return releases[0]; diff --git a/src/installer.ts b/src/installer.ts index 975ace211..84c9242f1 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -66,7 +66,7 @@ export async function getGo( versionSpec, auth, arch, - manifest as (tc.IToolRelease & IGoVersion)[] + manifest ); } @@ -279,7 +279,7 @@ export async function findMatch( versionSpec, undefined, arch, - fixedCandidates as (tc.IToolRelease & IGoVersion)[] + fixedCandidates ); } @@ -375,16 +375,22 @@ export async function resolveStableVersionInput( versionSpec: string, auth: string | undefined, arch = os.arch(), - manifest: (tc.IToolRelease & IGoVersion)[] | undefined + manifest: tc.IToolRelease[] | IGoVersion[] | undefined ): Promise { if (!manifest) { core.debug('No manifest cached'); - manifest = (await getManifest(auth)) as (tc.IToolRelease & IGoVersion)[]; + manifest = await getManifest(auth); } const releases = manifest - .filter(release => !!release.files.find(file => file.arch === arch)) - .map(release => release.version); + .map(item => { + const index = item.files.findIndex(item => item.arch === arch); + if (index === -1) { + return ''; + } + return item.version; + }) + .filter(item => !!item); if (versionSpec === StableReleaseAlias.Stable) { core.info(`stable version resolved as ${releases[0]}`);