mirror of
https://code.forgejo.org/actions/setup-python
synced 2025-06-09 04:42:20 +02:00
Add check-latest functionality (#406)
This commit is contained in:
parent
49a521fa06
commit
2f06e9da25
14 changed files with 440 additions and 82 deletions
|
@ -33,12 +33,34 @@ function binDir(installDir: string): string {
|
|||
export async function useCpythonVersion(
|
||||
version: string,
|
||||
architecture: string,
|
||||
updateEnvironment: boolean
|
||||
updateEnvironment: boolean,
|
||||
checkLatest: boolean
|
||||
): 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}`);
|
||||
|
||||
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,
|
||||
|
@ -50,7 +72,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