mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-05-08 02:36:51 +00:00
Refactor version resolving (#852)
This commit is contained in:
committed by
GitHub
parent
cb84d12dc6
commit
cdfb2ee6dd
@@ -111,6 +111,9 @@ export async function getLatestVersion(
|
||||
export async function getAllVersions(
|
||||
manifestUrl: string = VERSIONS_MANIFEST_URL,
|
||||
): Promise<string[]> {
|
||||
core.info(
|
||||
`Getting available versions from ${manifestSource(manifestUrl)} ...`,
|
||||
);
|
||||
const versions = await fetchManifest(manifestUrl);
|
||||
return versions.map((versionData) => versionData.version);
|
||||
}
|
||||
@@ -165,6 +168,14 @@ export function clearManifestCache(manifestUrl?: string): void {
|
||||
cachedManifestData.delete(manifestUrl);
|
||||
}
|
||||
|
||||
function manifestSource(manifestUrl: string): string {
|
||||
if (manifestUrl === VERSIONS_MANIFEST_URL) {
|
||||
return VERSIONS_MANIFEST_URL;
|
||||
}
|
||||
|
||||
return `manifest-file ${manifestUrl}`;
|
||||
}
|
||||
|
||||
function isManifestVersion(value: unknown): value is ManifestVersion {
|
||||
if (!isRecord(value)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user