mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 23:42:13 +00:00
Deal with possible multiple artifacts for a single releases
This commit is contained in:
parent
546edbcc91
commit
8c79e75976
1 changed files with 32 additions and 27 deletions
|
@ -10,7 +10,6 @@ import fs from 'fs';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IS_WINDOWS,
|
IS_WINDOWS,
|
||||||
IGraalPyManifestAsset,
|
|
||||||
IGraalPyManifestRelease,
|
IGraalPyManifestRelease,
|
||||||
createSymlinkInFolder,
|
createSymlinkInFolder,
|
||||||
isNightlyKeyword,
|
isNightlyKeyword,
|
||||||
|
@ -223,35 +222,41 @@ export function findRelease(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function toGraalPyPlatform(platform: string) {
|
||||||
|
switch (platform) {
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
}
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toGraalPyArchitecture(architecture: string) {
|
||||||
|
switch (architecture) {
|
||||||
|
case 'x64':
|
||||||
|
return 'amd64';
|
||||||
|
case 'arm64':
|
||||||
|
return 'aarch64';
|
||||||
|
}
|
||||||
|
return architecture;
|
||||||
|
}
|
||||||
|
|
||||||
export function findAsset(
|
export function findAsset(
|
||||||
item: IGraalPyManifestRelease,
|
item: IGraalPyManifestRelease,
|
||||||
architecture: string,
|
architecture: string,
|
||||||
platform: string
|
platform: string
|
||||||
) {
|
) {
|
||||||
const graalpyArch =
|
const graalpyArch = toGraalPyArchitecture(architecture);
|
||||||
architecture === 'x64'
|
const graalpyPlatform = toGraalPyPlatform(platform);
|
||||||
? 'amd64'
|
const found = item.assets.filter(
|
||||||
: architecture === 'arm64'
|
file =>
|
||||||
? 'aarch64'
|
file.name.startsWith('graalpy') &&
|
||||||
: architecture;
|
file.name.endsWith(`-${graalpyPlatform}-${graalpyArch}.tar.gz`)
|
||||||
const graalpyPlatform =
|
);
|
||||||
platform === 'win32'
|
/*
|
||||||
? 'windows'
|
In the future there could be more variants of GraalPy for a single release. Pick the shortest name, that one is the most likely to be the primary variant.
|
||||||
: platform === 'darwin'
|
*/
|
||||||
? 'macos'
|
found.sort((f1, f2) => f1.name.length - f2.name.length);
|
||||||
: platform;
|
return found[0];
|
||||||
if (item.assets.length) {
|
|
||||||
return item.assets.find((file: IGraalPyManifestAsset) => {
|
|
||||||
const match_data = file.name.match(
|
|
||||||
'.*(macos|linux|windows)-(amd64|aarch64).tar.gz$'
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
match_data &&
|
|
||||||
match_data[1] === graalpyPlatform &&
|
|
||||||
match_data[2] === graalpyArch
|
|
||||||
);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue