mirror of
https://github.com/actions/setup-python.git
synced 2026-01-20 21:08:54 +08:00
add check-latest for python versions
This commit is contained in:
parent
c57f79353b
commit
4841389b47
9 changed files with 2136 additions and 1635 deletions
|
|
@ -34,10 +34,25 @@ export async function useCpythonVersion(
|
|||
version: string,
|
||||
architecture: string
|
||||
): Promise<InstalledVersion> {
|
||||
let manifest: tc.IToolRelease[] | null = null;
|
||||
const desugaredVersionSpec = desugarDevVersion(version);
|
||||
const semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec);
|
||||
let semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec);
|
||||
core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`);
|
||||
|
||||
const checkLatest = core.getBooleanInput('check-latest');
|
||||
|
||||
if (checkLatest) {
|
||||
manifest = await installer.getManifest();
|
||||
const resolvedVersion = (await installer.findReleaseFromManifest(semanticVersionSpec, architecture, manifest))?.version;
|
||||
|
||||
if(resolvedVersion) {
|
||||
semanticVersionSpec = resolvedVersion;
|
||||
core.info(`Resolved as '${semanticVersionSpec}'`);
|
||||
} else {
|
||||
core.info(`Failed to resolve version ${semanticVersionSpec} from manifest`);
|
||||
}
|
||||
}
|
||||
|
||||
let installDir: string | null = tc.find(
|
||||
'Python',
|
||||
semanticVersionSpec,
|
||||
|
|
@ -49,7 +64,8 @@ export async function useCpythonVersion(
|
|||
);
|
||||
const foundRelease = await installer.findReleaseFromManifest(
|
||||
semanticVersionSpec,
|
||||
architecture
|
||||
architecture,
|
||||
manifest
|
||||
);
|
||||
|
||||
if (foundRelease && foundRelease.files && foundRelease.files.length > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue