mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-10-19 09:07:00 +00:00
Shortcut to latest version for minimum version specifier (#598)
This is faster than downloading all available versions from GitHub to determine the highest matching version. Fixes: #585
This commit is contained in:
committed by
GitHub
parent
d0cc045d04
commit
d8a37f6566
@@ -135,19 +135,29 @@ export async function resolveVersion(
|
||||
): Promise<string> {
|
||||
core.debug(`Resolving version: ${versionInput}`);
|
||||
let version: string;
|
||||
const isSimpleMinimumVersionSpecifier =
|
||||
versionInput.includes(">") && !versionInput.includes(",");
|
||||
if (isSimpleMinimumVersionSpecifier) {
|
||||
core.info("Found minimum version specifier, using latest version");
|
||||
}
|
||||
if (manifestFile) {
|
||||
version =
|
||||
versionInput === "latest"
|
||||
versionInput === "latest" || isSimpleMinimumVersionSpecifier
|
||||
? await getLatestVersionInManifest(manifestFile)
|
||||
: versionInput;
|
||||
} else {
|
||||
version =
|
||||
versionInput === "latest"
|
||||
versionInput === "latest" || isSimpleMinimumVersionSpecifier
|
||||
? await getLatestVersion(githubToken)
|
||||
: versionInput;
|
||||
}
|
||||
if (tc.isExplicitVersion(version)) {
|
||||
core.debug(`Version ${version} is an explicit version.`);
|
||||
if (isSimpleMinimumVersionSpecifier) {
|
||||
if (!pep440.satisfies(version, versionInput)) {
|
||||
throw new Error(`No version found for ${versionInput}`);
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
const availableVersions = await getAvailableVersions(githubToken);
|
||||
|
Reference in New Issue
Block a user