mirror of
https://code.forgejo.org/actions/setup-go
synced 2025-06-10 12:32:23 +02:00
Include platform filter for aliases
This commit is contained in:
parent
2a148a10b5
commit
3eeab9dd6d
2 changed files with 19 additions and 7 deletions
8
dist/setup/index.js
vendored
8
dist/setup/index.js
vendored
|
@ -63234,7 +63234,7 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
|
|||
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
|
||||
versionSpec === utils_1.StableReleaseAlias.OldStable) {
|
||||
manifest = yield getManifest(auth);
|
||||
versionSpec = yield resolveStableVersionInput(versionSpec, arch, manifest);
|
||||
versionSpec = yield resolveStableVersionInput(versionSpec, arch, osPlat, manifest);
|
||||
}
|
||||
if (checkLatest) {
|
||||
core.info('Attempting to resolve the latest version from the manifest...');
|
||||
|
@ -63405,7 +63405,7 @@ function findMatch(versionSpec, arch = os_1.default.arch()) {
|
|||
const fixedCandidates = candidates.map(item => {
|
||||
return Object.assign(Object.assign({}, item), { version: makeSemver(item.version) });
|
||||
});
|
||||
versionSpec = yield resolveStableVersionInput(versionSpec, archFilter, fixedCandidates);
|
||||
versionSpec = yield resolveStableVersionInput(versionSpec, archFilter, platFilter, fixedCandidates);
|
||||
}
|
||||
let goFile;
|
||||
for (let i = 0; i < candidates.length; i++) {
|
||||
|
@ -63479,12 +63479,12 @@ function parseGoVersionFile(versionFilePath) {
|
|||
return contents.trim();
|
||||
}
|
||||
exports.parseGoVersionFile = parseGoVersionFile;
|
||||
function resolveStableVersionInput(versionSpec, arch = os_1.default.arch(), manifest) {
|
||||
function resolveStableVersionInput(versionSpec, arch = os_1.default.arch(), platform, manifest) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const releases = manifest
|
||||
.map(item => {
|
||||
const index = item.files.findIndex(item => item.arch === arch);
|
||||
const index = item.files.findIndex(item => item.arch === arch && item.filename.includes(platform));
|
||||
if (index === -1) {
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -44,7 +44,12 @@ export async function getGo(
|
|||
versionSpec === StableReleaseAlias.OldStable
|
||||
) {
|
||||
manifest = await getManifest(auth);
|
||||
versionSpec = await resolveStableVersionInput(versionSpec, arch, manifest);
|
||||
versionSpec = await resolveStableVersionInput(
|
||||
versionSpec,
|
||||
arch,
|
||||
osPlat,
|
||||
manifest
|
||||
);
|
||||
}
|
||||
|
||||
if (checkLatest) {
|
||||
|
@ -267,11 +272,15 @@ export async function findMatch(
|
|||
versionSpec === StableReleaseAlias.OldStable
|
||||
) {
|
||||
const fixedCandidates = candidates.map(item => {
|
||||
return {...item, version: makeSemver(item.version)};
|
||||
return {
|
||||
...item,
|
||||
version: makeSemver(item.version)
|
||||
};
|
||||
});
|
||||
versionSpec = await resolveStableVersionInput(
|
||||
versionSpec,
|
||||
archFilter,
|
||||
platFilter,
|
||||
fixedCandidates
|
||||
);
|
||||
}
|
||||
|
@ -367,11 +376,14 @@ export function parseGoVersionFile(versionFilePath: string): string {
|
|||
export async function resolveStableVersionInput(
|
||||
versionSpec: string,
|
||||
arch = os.arch(),
|
||||
platform: string,
|
||||
manifest: tc.IToolRelease[] | IGoVersion[]
|
||||
): Promise<string> {
|
||||
const releases = manifest
|
||||
.map(item => {
|
||||
const index = item.files.findIndex(item => item.arch === arch);
|
||||
const index = item.files.findIndex(
|
||||
item => item.arch === arch && item.filename.includes(platform)
|
||||
);
|
||||
if (index === -1) {
|
||||
return '';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue