mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-10-19 00:56:43 +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
13
dist/setup/index.js
generated
vendored
13
dist/setup/index.js
generated
vendored
@@ -129037,20 +129037,29 @@ function getExtension(platform) {
|
||||
async function resolveVersion(versionInput, manifestFile, githubToken) {
|
||||
core.debug(`Resolving version: ${versionInput}`);
|
||||
let version;
|
||||
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 (0, version_manifest_1.getLatestKnownVersion)(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