Use latest version from manifest-file (#458)

If a manifest-file is supplied the default value of the version input
(latest) will get the latest version available in the manifest. That
might not be the actual latest version available in the official uv
repo.
This commit is contained in:
Kevin Stillhammer authored and GitHub committed 2025-06-19 21:23:43 +02:00
1 parent a02a550bdd
commit 445689ea25
5 files changed
+46 -17

No files matched your search

Generated Vendored
+18 -8
View File
@@ -124735,11 +124735,21 @@ async function downloadVersion(downloadUrl, artifactName, platform, arch, versio
function getExtension(platform) {
return platform === "pc-windows-msvc" ? ".zip" : ".tar.gz";
}
async function resolveVersion(versionInput, githubToken) {
async function resolveVersion(versionInput, manifestFile, githubToken) {
core.debug(`Resolving version: ${versionInput}`);
const version = versionInput === "latest"
? await getLatestVersion(githubToken)
: versionInput;
let version;
if (manifestFile) {
version =
versionInput === "latest"
? await (0, version_manifest_1.getLatestKnownVersion)(manifestFile)
: versionInput;
}
else {
version =
versionInput === "latest"
? await getLatestVersion(githubToken)
: versionInput;
}
if (tc.isExplicitVersion(version)) {
core.debug(`Version ${version} is an explicit version.`);
return version;
@@ -125105,7 +125115,7 @@ function detectEmptyWorkdir() {
}
}
async function setupUv(platform, arch, checkSum, githubToken) {
const resolvedVersion = await determineVersion();
const resolvedVersion = await determineVersion(inputs_1.manifestFile);
const toolCacheResult = (0, download_version_1.tryGetFromToolCache)(arch, resolvedVersion);
if (toolCacheResult.installedPath) {
core.info(`Found uv in tool-cache for ${toolCacheResult.version}`);
@@ -125127,16 +125137,16 @@ async function setupUv(platform, arch, checkSum, githubToken) {
version: downloadVersionResult.version,
};
}
async function determineVersion() {
async function determineVersion(manifestFile) {
if (inputs_1.version !== "") {
return await (0, download_version_1.resolveVersion)(inputs_1.version, inputs_1.githubToken);
return await (0, download_version_1.resolveVersion)(inputs_1.version, manifestFile, inputs_1.githubToken);
}
const versionFromUvToml = (0, config_file_1.getUvVersionFromConfigFile)(`${inputs_1.workingDirectory}${path.sep}uv.toml`);
const versionFromPyproject = (0, config_file_1.getUvVersionFromConfigFile)(`${inputs_1.workingDirectory}${path.sep}pyproject.toml`);
if (versionFromUvToml === undefined && versionFromPyproject === undefined) {
core.info("Could not determine uv version from uv.toml or pyproject.toml. Falling back to latest.");
}
return await (0, download_version_1.resolveVersion)(versionFromUvToml || versionFromPyproject || "latest", inputs_1.githubToken);
return await (0, download_version_1.resolveVersion)(versionFromUvToml || versionFromPyproject || "latest", manifestFile, inputs_1.githubToken);
}
function addUvToPathAndOutput(cachedPath) {
core.setOutput("uv-path", `${cachedPath}${path.sep}uv`);