This commit is contained in:
Zanie Blue
2026-01-22 07:57:07 -06:00
parent 0a4c5102bd
commit 8bd9170ab9
9 changed files with 106 additions and 272 deletions

View File

@@ -27,7 +27,6 @@ jobs:
node dist/update-known-versions/index.js node dist/update-known-versions/index.js
src/download/checksum/known-checksums.ts src/download/checksum/known-checksums.ts
version-manifest.json version-manifest.json
${{ secrets.GITHUB_TOKEN }}
- name: Check for changes - name: Check for changes
id: changes-exist id: changes-exist
run: | run: |

View File

@@ -23,13 +23,12 @@ function createMockResponse(
statusText: string, statusText: string,
data: string, data: string,
) { ) {
const encoder = new TextEncoder(); return {
const body = { ok,
async *[Symbol.asyncIterator]() { status,
yield encoder.encode(data); statusText,
}, text: async () => data,
}; };
return { body, ok, status, statusText };
} }
describe("versions-client", () => { describe("versions-client", () => {

96
dist/setup/index.js generated vendored
View File

@@ -91627,37 +91627,33 @@ const fs = __importStar(__nccwpck_require__(3024));
const core = __importStar(__nccwpck_require__(7484)); const core = __importStar(__nccwpck_require__(7484));
const known_checksums_1 = __nccwpck_require__(2764); const known_checksums_1 = __nccwpck_require__(2764);
async function validateChecksum(checkSum, downloadPath, arch, platform, version, ndjsonChecksum) { async function validateChecksum(checkSum, downloadPath, arch, platform, version, ndjsonChecksum) {
let isValid;
let checksumUsed;
// Priority: user-provided checksum > KNOWN_CHECKSUMS > NDJSON fallback // Priority: user-provided checksum > KNOWN_CHECKSUMS > NDJSON fallback
if (checkSum !== undefined && checkSum !== "") {
checksumUsed = checkSum;
core.debug("Using user-provided checksum.");
isValid = await validateFileCheckSum(downloadPath, checkSum);
}
else {
const key = `${arch}-${platform}-${version}`; const key = `${arch}-${platform}-${version}`;
if (key in known_checksums_1.KNOWN_CHECKSUMS) { let checksumToUse;
checksumUsed = known_checksums_1.KNOWN_CHECKSUMS[key]; let source;
core.debug(`Using known checksum for ${key}.`); if (checkSum !== undefined && checkSum !== "") {
isValid = await validateFileCheckSum(downloadPath, checksumUsed); checksumToUse = checkSum;
source = "user-provided";
}
else if (key in known_checksums_1.KNOWN_CHECKSUMS) {
checksumToUse = known_checksums_1.KNOWN_CHECKSUMS[key];
source = `known checksum for ${key}`;
} }
else if (ndjsonChecksum !== undefined && ndjsonChecksum !== "") { else if (ndjsonChecksum !== undefined && ndjsonChecksum !== "") {
checksumUsed = ndjsonChecksum; checksumToUse = ndjsonChecksum;
core.debug("Using checksum from NDJSON version data."); source = "NDJSON version data";
isValid = await validateFileCheckSum(downloadPath, ndjsonChecksum);
} }
else { else {
core.debug(`No checksum found for ${key}.`); core.debug(`No checksum found for ${key}.`);
return;
} }
core.debug(`Using ${source}.`);
const isValid = await validateFileCheckSum(downloadPath, checksumToUse);
if (!isValid) {
throw new Error(`Checksum for ${downloadPath} did not match ${checksumToUse}.`);
} }
if (isValid === false) {
throw new Error(`Checksum for ${downloadPath} did not match ${checksumUsed}.`);
}
if (isValid === true) {
core.debug(`Checksum for ${downloadPath} is valid.`); core.debug(`Checksum for ${downloadPath} is valid.`);
} }
}
async function validateFileCheckSum(filePath, expected) { async function validateFileCheckSum(filePath, expected) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const hash = crypto.createHash("sha256"); const hash = crypto.createHash("sha256");
@@ -95882,7 +95878,7 @@ var __importStar = (this && this.__importStar) || (function () {
})(); })();
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.tryGetFromToolCache = tryGetFromToolCache; exports.tryGetFromToolCache = tryGetFromToolCache;
exports.downloadVersionFromGithub = downloadVersionFromGithub; exports.downloadVersionFromNdjson = downloadVersionFromNdjson;
exports.downloadVersionFromManifest = downloadVersionFromManifest; exports.downloadVersionFromManifest = downloadVersionFromManifest;
exports.resolveVersion = resolveVersion; exports.resolveVersion = resolveVersion;
const node_fs_1 = __nccwpck_require__(3024); const node_fs_1 = __nccwpck_require__(3024);
@@ -95906,17 +95902,11 @@ function tryGetFromToolCache(arch, version) {
const installedPath = tc.find(constants_1.TOOL_CACHE_NAME, resolvedVersion, arch); const installedPath = tc.find(constants_1.TOOL_CACHE_NAME, resolvedVersion, arch);
return { installedPath, version: resolvedVersion }; return { installedPath, version: resolvedVersion };
} }
async function downloadVersionFromGithub(platform, arch, version, checkSum, githubToken) { async function downloadVersionFromNdjson(platform, arch, version, checkSum, githubToken) {
const artifact = `uv-${arch}-${platform}`; const artifact = `uv-${arch}-${platform}`;
const extension = getExtension(platform); const extension = getExtension(platform);
// Try to get artifact info from NDJSON (includes checksum) // Get artifact info from NDJSON (includes URL and checksum)
let artifactInfo; const artifactInfo = await (0, versions_client_1.getArtifact)(version, arch, platform);
try {
artifactInfo = await (0, versions_client_1.getArtifact)(version, arch, platform);
}
catch (err) {
core.debug(`Failed to get artifact from NDJSON: ${err.message}`);
}
const downloadUrl = artifactInfo?.url ?? const downloadUrl = artifactInfo?.url ??
`https://github.com/${constants_1.OWNER}/${constants_1.REPO}/releases/download/${version}/${artifact}${extension}`; `https://github.com/${constants_1.OWNER}/${constants_1.REPO}/releases/download/${version}/${artifact}${extension}`;
return await downloadVersion(downloadUrl, artifact, platform, arch, version, checkSum, githubToken, artifactInfo?.sha256); return await downloadVersion(downloadUrl, artifact, platform, arch, version, checkSum, githubToken, artifactInfo?.sha256);
@@ -95924,19 +95914,9 @@ async function downloadVersionFromGithub(platform, arch, version, checkSum, gith
async function downloadVersionFromManifest(manifestUrl, platform, arch, version, checkSum, githubToken) { async function downloadVersionFromManifest(manifestUrl, platform, arch, version, checkSum, githubToken) {
const downloadUrl = await (0, version_manifest_1.getDownloadUrl)(manifestUrl, version, arch, platform); const downloadUrl = await (0, version_manifest_1.getDownloadUrl)(manifestUrl, version, arch, platform);
if (!downloadUrl) { if (!downloadUrl) {
core.info(`manifest-file does not contain version ${version}, arch ${arch}, platform ${platform}. Falling back to GitHub releases.`); throw new Error(`manifest-file does not contain version ${version}, arch ${arch}, platform ${platform}.`);
return await downloadVersionFromGithub(platform, arch, version, checkSum, githubToken);
} }
// Try to get checksum from NDJSON for manifest downloads too return await downloadVersion(downloadUrl, `uv-${arch}-${platform}`, platform, arch, version, checkSum, githubToken, undefined);
let ndjsonChecksum;
try {
const artifactInfo = await (0, versions_client_1.getArtifact)(version, arch, platform);
ndjsonChecksum = artifactInfo?.sha256;
}
catch (err) {
core.debug(`Failed to get artifact from NDJSON: ${err.message}`);
}
return await downloadVersion(downloadUrl, `uv-${arch}-${platform}`, platform, arch, version, checkSum, githubToken, ndjsonChecksum);
} }
async function downloadVersion(downloadUrl, artifactName, platform, arch, version, checkSum, githubToken, ndjsonChecksum) { async function downloadVersion(downloadUrl, artifactName, platform, arch, version, checkSum, githubToken, ndjsonChecksum) {
core.info(`Downloading uv from "${downloadUrl}" ...`); core.info(`Downloading uv from "${downloadUrl}" ...`);
@@ -96205,20 +96185,9 @@ async function fetchVersionData() {
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to fetch version data: ${response.status} ${response.statusText}`); throw new Error(`Failed to fetch version data: ${response.status} ${response.statusText}`);
} }
const body = await response.text();
const versions = []; const versions = [];
if (!response.body) { for (const line of body.split("\n")) {
throw new Error("Response body is null");
}
// Stream and parse NDJSON line by line
const decoder = new TextDecoder();
let buffer = "";
for await (const chunk of response.body) {
buffer += decoder.decode(chunk, { stream: true });
// Process complete lines
const lines = buffer.split("\n");
// Keep the last potentially incomplete line in buffer
buffer = lines.pop() ?? "";
for (const line of lines) {
const trimmed = line.trim(); const trimmed = line.trim();
if (trimmed === "") { if (trimmed === "") {
continue; continue;
@@ -96231,18 +96200,6 @@ async function fetchVersionData() {
core.debug(`Failed to parse NDJSON line: ${trimmed}`); core.debug(`Failed to parse NDJSON line: ${trimmed}`);
} }
} }
}
// Process any remaining content in buffer
const remaining = buffer.trim();
if (remaining !== "") {
try {
const version = JSON.parse(remaining);
versions.push(version);
}
catch {
core.debug(`Failed to parse NDJSON line: ${remaining}`);
}
}
if (versions.length === 0) { if (versions.length === 0) {
throw new Error("No version data found in NDJSON file"); throw new Error("No version data found in NDJSON file");
} }
@@ -96513,7 +96470,10 @@ async function setupUv(platform, arch, checkSum, githubToken) {
version: toolCacheResult.version, version: toolCacheResult.version,
}; };
} }
const downloadVersionResult = await (0, download_version_1.downloadVersionFromManifest)(inputs_1.manifestFile, platform, arch, resolvedVersion, checkSum, githubToken); // Use the same source for download as we used for version resolution
const downloadVersionResult = inputs_1.manifestFile
? await (0, download_version_1.downloadVersionFromManifest)(inputs_1.manifestFile, platform, arch, resolvedVersion, checkSum, githubToken)
: await (0, download_version_1.downloadVersionFromNdjson)(platform, arch, resolvedVersion, checkSum, githubToken);
return { return {
uvDir: downloadVersionResult.cachedToolDir, uvDir: downloadVersionResult.cachedToolDir,
version: downloadVersionResult.version, version: downloadVersionResult.version,

89
dist/update-known-versions/index.js generated vendored
View File

@@ -27471,20 +27471,9 @@ async function fetchVersionData() {
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to fetch version data: ${response.status} ${response.statusText}`); throw new Error(`Failed to fetch version data: ${response.status} ${response.statusText}`);
} }
const body = await response.text();
const versions = []; const versions = [];
if (!response.body) { for (const line of body.split("\n")) {
throw new Error("Response body is null");
}
// Stream and parse NDJSON line by line
const decoder = new TextDecoder();
let buffer = "";
for await (const chunk of response.body) {
buffer += decoder.decode(chunk, { stream: true });
// Process complete lines
const lines = buffer.split("\n");
// Keep the last potentially incomplete line in buffer
buffer = lines.pop() ?? "";
for (const line of lines) {
const trimmed = line.trim(); const trimmed = line.trim();
if (trimmed === "") { if (trimmed === "") {
continue; continue;
@@ -27497,18 +27486,6 @@ async function fetchVersionData() {
core.debug(`Failed to parse NDJSON line: ${trimmed}`); core.debug(`Failed to parse NDJSON line: ${trimmed}`);
} }
} }
}
// Process any remaining content in buffer
const remaining = buffer.trim();
if (remaining !== "") {
try {
const version = JSON.parse(remaining);
versions.push(version);
}
catch {
core.debug(`Failed to parse NDJSON line: ${remaining}`);
}
}
if (versions.length === 0) { if (versions.length === 0) {
throw new Error("No version data found in NDJSON file"); throw new Error("No version data found in NDJSON file");
} }
@@ -27595,6 +27572,7 @@ var __importStar = (this && this.__importStar) || (function () {
}; };
})(); })();
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const node_fs_1 = __nccwpck_require__(3024);
const core = __importStar(__nccwpck_require__(7484)); const core = __importStar(__nccwpck_require__(7484));
const semver = __importStar(__nccwpck_require__(9318)); const semver = __importStar(__nccwpck_require__(9318));
const update_known_checksums_1 = __nccwpck_require__(6182); const update_known_checksums_1 = __nccwpck_require__(6182);
@@ -27655,7 +27633,6 @@ async function run() {
core.setOutput("latest-version", latestVersion); core.setOutput("latest-version", latestVersion);
} }
async function updateVersionManifestFromEntries(filePath, entries) { async function updateVersionManifestFromEntries(filePath, entries) {
const { promises: fs } = await Promise.resolve(/* import() */).then(__nccwpck_require__.t.bind(__nccwpck_require__, 3024, 23));
const manifest = entries.map((entry) => ({ const manifest = entries.map((entry) => ({
arch: entry.arch, arch: entry.arch,
artifactName: entry.artifactName, artifactName: entry.artifactName,
@@ -27664,7 +27641,7 @@ async function updateVersionManifestFromEntries(filePath, entries) {
version: entry.version, version: entry.version,
})); }));
core.debug(`Updating manifest-file: ${JSON.stringify(manifest)}`); core.debug(`Updating manifest-file: ${JSON.stringify(manifest)}`);
await fs.writeFile(filePath, JSON.stringify(manifest)); await node_fs_1.promises.writeFile(filePath, JSON.stringify(manifest));
} }
run(); run();
@@ -29639,64 +29616,6 @@ module.exports = parseParams
/******/ } /******/ }
/******/ /******/
/************************************************************************/ /************************************************************************/
/******/ /* webpack/runtime/create fake namespace object */
/******/ (() => {
/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
/******/ var leafPrototypes;
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 16: return value when it's Promise-like
/******/ // mode & 8|1: behave like require
/******/ __nccwpck_require__.t = function(value, mode) {
/******/ if(mode & 1) value = this(value);
/******/ if(mode & 8) return value;
/******/ if(typeof value === 'object' && value) {
/******/ if((mode & 4) && value.__esModule) return value;
/******/ if((mode & 16) && typeof value.then === 'function') return value;
/******/ }
/******/ var ns = Object.create(null);
/******/ __nccwpck_require__.r(ns);
/******/ var def = {};
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
/******/ }
/******/ def['default'] = () => (value);
/******/ __nccwpck_require__.d(ns, def);
/******/ return ns;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __nccwpck_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __nccwpck_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat */ /******/ /* webpack/runtime/compat */
/******/ /******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";

View File

@@ -13,38 +13,35 @@ export async function validateChecksum(
version: string, version: string,
ndjsonChecksum?: string, ndjsonChecksum?: string,
): Promise<void> { ): Promise<void> {
let isValid: boolean | undefined;
let checksumUsed: string | undefined;
// Priority: user-provided checksum > KNOWN_CHECKSUMS > NDJSON fallback // Priority: user-provided checksum > KNOWN_CHECKSUMS > NDJSON fallback
if (checkSum !== undefined && checkSum !== "") {
checksumUsed = checkSum;
core.debug("Using user-provided checksum.");
isValid = await validateFileCheckSum(downloadPath, checkSum);
} else {
const key = `${arch}-${platform}-${version}`; const key = `${arch}-${platform}-${version}`;
if (key in KNOWN_CHECKSUMS) { let checksumToUse: string | undefined;
checksumUsed = KNOWN_CHECKSUMS[key]; let source: string;
core.debug(`Using known checksum for ${key}.`);
isValid = await validateFileCheckSum(downloadPath, checksumUsed); if (checkSum !== undefined && checkSum !== "") {
checksumToUse = checkSum;
source = "user-provided";
} else if (key in KNOWN_CHECKSUMS) {
checksumToUse = KNOWN_CHECKSUMS[key];
source = `known checksum for ${key}`;
} else if (ndjsonChecksum !== undefined && ndjsonChecksum !== "") { } else if (ndjsonChecksum !== undefined && ndjsonChecksum !== "") {
checksumUsed = ndjsonChecksum; checksumToUse = ndjsonChecksum;
core.debug("Using checksum from NDJSON version data."); source = "NDJSON version data";
isValid = await validateFileCheckSum(downloadPath, ndjsonChecksum);
} else { } else {
core.debug(`No checksum found for ${key}.`); core.debug(`No checksum found for ${key}.`);
} return;
} }
if (isValid === false) { core.debug(`Using ${source}.`);
const isValid = await validateFileCheckSum(downloadPath, checksumToUse);
if (!isValid) {
throw new Error( throw new Error(
`Checksum for ${downloadPath} did not match ${checksumUsed}.`, `Checksum for ${downloadPath} did not match ${checksumToUse}.`,
); );
} }
if (isValid === true) {
core.debug(`Checksum for ${downloadPath} is valid.`); core.debug(`Checksum for ${downloadPath} is valid.`);
} }
}
async function validateFileCheckSum( async function validateFileCheckSum(
filePath: string, filePath: string,

View File

@@ -8,11 +8,10 @@ import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
import type { Architecture, Platform } from "../utils/platforms"; import type { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum"; import { validateChecksum } from "./checksum/checksum";
import { import {
getDownloadUrl,
getLatestKnownVersion as getLatestVersionInManifest, getLatestKnownVersion as getLatestVersionInManifest,
getDownloadUrl as getManifestDownloadUrl,
} from "./version-manifest"; } from "./version-manifest";
import { import {
type ArtifactResult,
getAllVersions, getAllVersions,
getArtifact, getArtifact,
getLatestVersion as getLatestVersionFromNdjson, getLatestVersion as getLatestVersionFromNdjson,
@@ -33,7 +32,7 @@ export function tryGetFromToolCache(
return { installedPath, version: resolvedVersion }; return { installedPath, version: resolvedVersion };
} }
export async function downloadVersionFromGithub( export async function downloadVersionFromNdjson(
platform: Platform, platform: Platform,
arch: Architecture, arch: Architecture,
version: string, version: string,
@@ -43,13 +42,8 @@ export async function downloadVersionFromGithub(
const artifact = `uv-${arch}-${platform}`; const artifact = `uv-${arch}-${platform}`;
const extension = getExtension(platform); const extension = getExtension(platform);
// Try to get artifact info from NDJSON (includes checksum) // Get artifact info from NDJSON (includes URL and checksum)
let artifactInfo: ArtifactResult | undefined; const artifactInfo = await getArtifact(version, arch, platform);
try {
artifactInfo = await getArtifact(version, arch, platform);
} catch (err) {
core.debug(`Failed to get artifact from NDJSON: ${(err as Error).message}`);
}
const downloadUrl = const downloadUrl =
artifactInfo?.url ?? artifactInfo?.url ??
@@ -68,39 +62,23 @@ export async function downloadVersionFromGithub(
} }
export async function downloadVersionFromManifest( export async function downloadVersionFromManifest(
manifestUrl: string | undefined, manifestUrl: string,
platform: Platform, platform: Platform,
arch: Architecture, arch: Architecture,
version: string, version: string,
checkSum: string | undefined, checkSum: string | undefined,
githubToken: string, githubToken: string,
): Promise<{ version: string; cachedToolDir: string }> { ): Promise<{ version: string; cachedToolDir: string }> {
const downloadUrl = await getDownloadUrl( const downloadUrl = await getManifestDownloadUrl(
manifestUrl, manifestUrl,
version, version,
arch, arch,
platform, platform,
); );
if (!downloadUrl) { if (!downloadUrl) {
core.info( throw new Error(
`manifest-file does not contain version ${version}, arch ${arch}, platform ${platform}. Falling back to GitHub releases.`, `manifest-file does not contain version ${version}, arch ${arch}, platform ${platform}.`,
); );
return await downloadVersionFromGithub(
platform,
arch,
version,
checkSum,
githubToken,
);
}
// Try to get checksum from NDJSON for manifest downloads too
let ndjsonChecksum: string | undefined;
try {
const artifactInfo = await getArtifact(version, arch, platform);
ndjsonChecksum = artifactInfo?.sha256;
} catch (err) {
core.debug(`Failed to get artifact from NDJSON: ${(err as Error).message}`);
} }
return await downloadVersion( return await downloadVersion(
@@ -111,7 +89,7 @@ export async function downloadVersionFromManifest(
version, version,
checkSum, checkSum,
githubToken, githubToken,
ndjsonChecksum, undefined, // No NDJSON checksum for manifest downloads
); );
} }

View File

@@ -31,25 +31,10 @@ export async function fetchVersionData(): Promise<NdjsonVersion[]> {
); );
} }
const body = await response.text();
const versions: NdjsonVersion[] = []; const versions: NdjsonVersion[] = [];
if (!response.body) { for (const line of body.split("\n")) {
throw new Error("Response body is null");
}
// Stream and parse NDJSON line by line
const decoder = new TextDecoder();
let buffer = "";
for await (const chunk of response.body) {
buffer += decoder.decode(chunk, { stream: true });
// Process complete lines
const lines = buffer.split("\n");
// Keep the last potentially incomplete line in buffer
buffer = lines.pop() ?? "";
for (const line of lines) {
const trimmed = line.trim(); const trimmed = line.trim();
if (trimmed === "") { if (trimmed === "") {
continue; continue;
@@ -61,18 +46,6 @@ export async function fetchVersionData(): Promise<NdjsonVersion[]> {
core.debug(`Failed to parse NDJSON line: ${trimmed}`); core.debug(`Failed to parse NDJSON line: ${trimmed}`);
} }
} }
}
// Process any remaining content in buffer
const remaining = buffer.trim();
if (remaining !== "") {
try {
const version = JSON.parse(remaining) as NdjsonVersion;
versions.push(version);
} catch {
core.debug(`Failed to parse NDJSON line: ${remaining}`);
}
}
if (versions.length === 0) { if (versions.length === 0) {
throw new Error("No version data found in NDJSON file"); throw new Error("No version data found in NDJSON file");

View File

@@ -5,6 +5,7 @@ import * as exec from "@actions/exec";
import { restoreCache } from "./cache/restore-cache"; import { restoreCache } from "./cache/restore-cache";
import { import {
downloadVersionFromManifest, downloadVersionFromManifest,
downloadVersionFromNdjson,
resolveVersion, resolveVersion,
tryGetFromToolCache, tryGetFromToolCache,
} from "./download/download-version"; } from "./download/download-version";
@@ -138,13 +139,22 @@ async function setupUv(
}; };
} }
const downloadVersionResult = await downloadVersionFromManifest( // Use the same source for download as we used for version resolution
const downloadVersionResult = manifestFile
? await downloadVersionFromManifest(
manifestFile, manifestFile,
platform, platform,
arch, arch,
resolvedVersion, resolvedVersion,
checkSum, checkSum,
githubToken, githubToken,
)
: await downloadVersionFromNdjson(
platform,
arch,
resolvedVersion,
checkSum,
githubToken,
); );
return { return {

View File

@@ -1,3 +1,4 @@
import { promises as fs } from "node:fs";
import * as core from "@actions/core"; import * as core from "@actions/core";
import * as semver from "semver"; import * as semver from "semver";
import { updateChecksums } from "./download/checksum/update-known-checksums"; import { updateChecksums } from "./download/checksum/update-known-checksums";
@@ -100,8 +101,6 @@ async function updateVersionManifestFromEntries(
filePath: string, filePath: string,
entries: ArtifactEntry[], entries: ArtifactEntry[],
): Promise<void> { ): Promise<void> {
const { promises: fs } = await import("node:fs");
const manifest = entries.map((entry) => ({ const manifest = entries.map((entry) => ({
arch: entry.arch, arch: entry.arch,
artifactName: entry.artifactName, artifactName: entry.artifactName,