mirror of
https://code.forgejo.org/actions/setup-go
synced 2025-06-11 04:52:25 +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 ||
|
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
|
||||||
versionSpec === utils_1.StableReleaseAlias.OldStable) {
|
versionSpec === utils_1.StableReleaseAlias.OldStable) {
|
||||||
manifest = yield getManifest(auth);
|
manifest = yield getManifest(auth);
|
||||||
versionSpec = yield resolveStableVersionInput(versionSpec, arch, manifest);
|
versionSpec = yield resolveStableVersionInput(versionSpec, arch, osPlat, manifest);
|
||||||
}
|
}
|
||||||
if (checkLatest) {
|
if (checkLatest) {
|
||||||
core.info('Attempting to resolve the latest version from the manifest...');
|
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 => {
|
const fixedCandidates = candidates.map(item => {
|
||||||
return Object.assign(Object.assign({}, item), { version: makeSemver(item.version) });
|
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;
|
let goFile;
|
||||||
for (let i = 0; i < candidates.length; i++) {
|
for (let i = 0; i < candidates.length; i++) {
|
||||||
|
@ -63479,12 +63479,12 @@ function parseGoVersionFile(versionFilePath) {
|
||||||
return contents.trim();
|
return contents.trim();
|
||||||
}
|
}
|
||||||
exports.parseGoVersionFile = parseGoVersionFile;
|
exports.parseGoVersionFile = parseGoVersionFile;
|
||||||
function resolveStableVersionInput(versionSpec, arch = os_1.default.arch(), manifest) {
|
function resolveStableVersionInput(versionSpec, arch = os_1.default.arch(), platform, manifest) {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const releases = manifest
|
const releases = manifest
|
||||||
.map(item => {
|
.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) {
|
if (index === -1) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,12 @@ export async function getGo(
|
||||||
versionSpec === StableReleaseAlias.OldStable
|
versionSpec === StableReleaseAlias.OldStable
|
||||||
) {
|
) {
|
||||||
manifest = await getManifest(auth);
|
manifest = await getManifest(auth);
|
||||||
versionSpec = await resolveStableVersionInput(versionSpec, arch, manifest);
|
versionSpec = await resolveStableVersionInput(
|
||||||
|
versionSpec,
|
||||||
|
arch,
|
||||||
|
osPlat,
|
||||||
|
manifest
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkLatest) {
|
if (checkLatest) {
|
||||||
|
@ -267,11 +272,15 @@ export async function findMatch(
|
||||||
versionSpec === StableReleaseAlias.OldStable
|
versionSpec === StableReleaseAlias.OldStable
|
||||||
) {
|
) {
|
||||||
const fixedCandidates = candidates.map(item => {
|
const fixedCandidates = candidates.map(item => {
|
||||||
return {...item, version: makeSemver(item.version)};
|
return {
|
||||||
|
...item,
|
||||||
|
version: makeSemver(item.version)
|
||||||
|
};
|
||||||
});
|
});
|
||||||
versionSpec = await resolveStableVersionInput(
|
versionSpec = await resolveStableVersionInput(
|
||||||
versionSpec,
|
versionSpec,
|
||||||
archFilter,
|
archFilter,
|
||||||
|
platFilter,
|
||||||
fixedCandidates
|
fixedCandidates
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -367,11 +376,14 @@ export function parseGoVersionFile(versionFilePath: string): string {
|
||||||
export async function resolveStableVersionInput(
|
export async function resolveStableVersionInput(
|
||||||
versionSpec: string,
|
versionSpec: string,
|
||||||
arch = os.arch(),
|
arch = os.arch(),
|
||||||
|
platform: string,
|
||||||
manifest: tc.IToolRelease[] | IGoVersion[]
|
manifest: tc.IToolRelease[] | IGoVersion[]
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const releases = manifest
|
const releases = manifest
|
||||||
.map(item => {
|
.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) {
|
if (index === -1) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue