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 2025-06-19 21:23:43 +02:00 committed by GitHub
parent a02a550bdd
commit 445689ea25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 46 additions and 17 deletions

View file

@ -7,7 +7,10 @@ import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
import type { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum";
import { Octokit } from "../utils/octokit";
import { getDownloadUrl } from "./version-manifest";
import {
getDownloadUrl,
getLatestKnownVersion as getLatestVersionInManifest,
} from "./version-manifest";
export function tryGetFromToolCache(
arch: Architecture,
@ -127,13 +130,22 @@ function getExtension(platform: Platform): string {
export async function resolveVersion(
versionInput: string,
manifestFile: string | undefined,
githubToken: string,
): Promise<string> {
core.debug(`Resolving version: ${versionInput}`);
const version =
versionInput === "latest"
? await getLatestVersion(githubToken)
: versionInput;
let version: string;
if (manifestFile) {
version =
versionInput === "latest"
? await getLatestVersionInManifest(manifestFile)
: versionInput;
} else {
version =
versionInput === "latest"
? await getLatestVersion(githubToken)
: versionInput;
}
if (tc.isExplicitVersion(version)) {
core.debug(`Version ${version} is an explicit version.`);
return version;