mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-02-18 23:11:44 +00:00
Remove redundant resolveVersion in download-version.ts
This commit is contained in:
parent
7bbb36f434
commit
eea6a0275e
2 changed files with 8 additions and 16 deletions
9
dist/setup/index.js
generated
vendored
9
dist/setup/index.js
generated
vendored
|
|
@ -124698,16 +124698,15 @@ function tryGetFromToolCache(arch, version) {
|
||||||
return { version: resolvedVersion, installedPath };
|
return { version: resolvedVersion, installedPath };
|
||||||
}
|
}
|
||||||
async function downloadVersion(serverUrl, platform, arch, version, checkSum, githubToken) {
|
async function downloadVersion(serverUrl, platform, arch, version, checkSum, githubToken) {
|
||||||
const resolvedVersion = await resolveVersion(version, githubToken);
|
|
||||||
const artifact = `uv-${arch}-${platform}`;
|
const artifact = `uv-${arch}-${platform}`;
|
||||||
let extension = ".tar.gz";
|
let extension = ".tar.gz";
|
||||||
if (platform === "pc-windows-msvc") {
|
if (platform === "pc-windows-msvc") {
|
||||||
extension = ".zip";
|
extension = ".zip";
|
||||||
}
|
}
|
||||||
const downloadUrl = `${serverUrl}/${constants_1.OWNER}/${constants_1.REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
|
const downloadUrl = `${serverUrl}/${constants_1.OWNER}/${constants_1.REPO}/releases/download/${version}/${artifact}${extension}`;
|
||||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||||
const downloadPath = await tc.downloadTool(downloadUrl, undefined, githubToken);
|
const downloadPath = await tc.downloadTool(downloadUrl, undefined, githubToken);
|
||||||
await (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, resolvedVersion);
|
await (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version);
|
||||||
let uvDir;
|
let uvDir;
|
||||||
if (platform === "pc-windows-msvc") {
|
if (platform === "pc-windows-msvc") {
|
||||||
const fullPathWithExtension = `${downloadPath}${extension}`;
|
const fullPathWithExtension = `${downloadPath}${extension}`;
|
||||||
|
|
@ -124719,8 +124718,8 @@ async function downloadVersion(serverUrl, platform, arch, version, checkSum, git
|
||||||
const extractedDir = await tc.extractTar(downloadPath);
|
const extractedDir = await tc.extractTar(downloadPath);
|
||||||
uvDir = path.join(extractedDir, artifact);
|
uvDir = path.join(extractedDir, artifact);
|
||||||
}
|
}
|
||||||
const cachedToolDir = await tc.cacheDir(uvDir, constants_1.TOOL_CACHE_NAME, resolvedVersion, arch);
|
const cachedToolDir = await tc.cacheDir(uvDir, constants_1.TOOL_CACHE_NAME, version, arch);
|
||||||
return { version: resolvedVersion, cachedToolDir };
|
return { version: version, cachedToolDir };
|
||||||
}
|
}
|
||||||
async function resolveVersion(versionInput, githubToken) {
|
async function resolveVersion(versionInput, githubToken) {
|
||||||
core.debug(`Resolving version: ${versionInput}`);
|
core.debug(`Resolving version: ${versionInput}`);
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,12 @@ export async function downloadVersion(
|
||||||
checkSum: string | undefined,
|
checkSum: string | undefined,
|
||||||
githubToken: string,
|
githubToken: string,
|
||||||
): Promise<{ version: string; cachedToolDir: string }> {
|
): Promise<{ version: string; cachedToolDir: string }> {
|
||||||
const resolvedVersion = await resolveVersion(version, githubToken);
|
|
||||||
const artifact = `uv-${arch}-${platform}`;
|
const artifact = `uv-${arch}-${platform}`;
|
||||||
let extension = ".tar.gz";
|
let extension = ".tar.gz";
|
||||||
if (platform === "pc-windows-msvc") {
|
if (platform === "pc-windows-msvc") {
|
||||||
extension = ".zip";
|
extension = ".zip";
|
||||||
}
|
}
|
||||||
const downloadUrl = `${serverUrl}/${OWNER}/${REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
|
const downloadUrl = `${serverUrl}/${OWNER}/${REPO}/releases/download/${version}/${artifact}${extension}`;
|
||||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||||
|
|
||||||
const downloadPath = await tc.downloadTool(
|
const downloadPath = await tc.downloadTool(
|
||||||
|
|
@ -45,13 +44,7 @@ export async function downloadVersion(
|
||||||
undefined,
|
undefined,
|
||||||
githubToken,
|
githubToken,
|
||||||
);
|
);
|
||||||
await validateChecksum(
|
await validateChecksum(checkSum, downloadPath, arch, platform, version);
|
||||||
checkSum,
|
|
||||||
downloadPath,
|
|
||||||
arch,
|
|
||||||
platform,
|
|
||||||
resolvedVersion,
|
|
||||||
);
|
|
||||||
|
|
||||||
let uvDir: string;
|
let uvDir: string;
|
||||||
if (platform === "pc-windows-msvc") {
|
if (platform === "pc-windows-msvc") {
|
||||||
|
|
@ -66,10 +59,10 @@ export async function downloadVersion(
|
||||||
const cachedToolDir = await tc.cacheDir(
|
const cachedToolDir = await tc.cacheDir(
|
||||||
uvDir,
|
uvDir,
|
||||||
TOOL_CACHE_NAME,
|
TOOL_CACHE_NAME,
|
||||||
resolvedVersion,
|
version,
|
||||||
arch,
|
arch,
|
||||||
);
|
);
|
||||||
return { version: resolvedVersion, cachedToolDir };
|
return { version: version, cachedToolDir };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resolveVersion(
|
export async function resolveVersion(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue