mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-01-25 21:22:07 +00:00
Try and fetch manifest from astral-sh/setup-uv@main first
This commit is contained in:
90
dist/setup/index.js
generated
vendored
90
dist/setup/index.js
generated
vendored
@@ -95905,12 +95905,24 @@ async function downloadVersionFromGithub(platform, arch, version, checkSum, gith
|
|||||||
return await downloadVersion(downloadUrl, artifact, platform, arch, version, checkSum, githubToken);
|
return await downloadVersion(downloadUrl, artifact, platform, arch, version, checkSum, githubToken);
|
||||||
}
|
}
|
||||||
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);
|
// If no user-provided manifest, try remote manifest first (will use cache if already fetched)
|
||||||
if (!downloadUrl) {
|
// then fall back to bundled manifest
|
||||||
core.info(`manifest-file does not contain version ${version}, arch ${arch}, platform ${platform}. Falling back to GitHub releases.`);
|
const manifestSources = manifestUrl !== undefined
|
||||||
return await downloadVersionFromGithub(platform, arch, version, checkSum, githubToken);
|
? [manifestUrl]
|
||||||
|
: [version_manifest_1.REMOTE_MANIFEST_URL, undefined];
|
||||||
|
for (const source of manifestSources) {
|
||||||
|
try {
|
||||||
|
const downloadUrl = await (0, version_manifest_1.getDownloadUrl)(source, version, arch, platform);
|
||||||
|
if (downloadUrl) {
|
||||||
|
return await downloadVersion(downloadUrl, `uv-${arch}-${platform}`, platform, arch, version, checkSum, githubToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.debug(`Failed to get download URL from manifest ${source}: ${err}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return await downloadVersion(downloadUrl, `uv-${arch}-${platform}`, platform, arch, version, checkSum, githubToken);
|
core.info(`Manifest does not contain version ${version}, arch ${arch}, platform ${platform}. Falling back to GitHub releases.`);
|
||||||
|
return await downloadVersionFromGithub(platform, arch, version, checkSum, githubToken);
|
||||||
}
|
}
|
||||||
async function downloadVersion(downloadUrl, artifactName, platform, arch, version, checkSum, githubToken) {
|
async function downloadVersion(downloadUrl, artifactName, platform, arch, version, checkSum, githubToken) {
|
||||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||||
@@ -95982,6 +95994,28 @@ async function resolveVersion(versionInput, manifestFile, githubToken, resolutio
|
|||||||
return resolvedVersion;
|
return resolvedVersion;
|
||||||
}
|
}
|
||||||
async function getAvailableVersions(githubToken) {
|
async function getAvailableVersions(githubToken) {
|
||||||
|
// 1. Try remote manifest first (no rate limits, always current)
|
||||||
|
try {
|
||||||
|
core.info("Getting available versions from remote manifest...");
|
||||||
|
const versions = await (0, version_manifest_1.getAvailableVersionsFromManifest)(version_manifest_1.REMOTE_MANIFEST_URL);
|
||||||
|
core.debug(`Found ${versions.length} versions from remote manifest`);
|
||||||
|
return versions;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.debug(`Remote manifest lookup failed: ${err}`);
|
||||||
|
}
|
||||||
|
// 2. Try GitHub API (rate limited but up-to-date)
|
||||||
|
try {
|
||||||
|
return await getAvailableVersionsFromGitHubApi(githubToken);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.debug(`GitHub API lookup failed: ${err}`);
|
||||||
|
}
|
||||||
|
// 3. Fall back to bundled manifest (no network, may be stale)
|
||||||
|
core.info("Getting available versions from bundled manifest...");
|
||||||
|
return await (0, version_manifest_1.getAvailableVersionsFromManifest)(undefined);
|
||||||
|
}
|
||||||
|
async function getAvailableVersionsFromGitHubApi(githubToken) {
|
||||||
core.info("Getting available versions from GitHub API...");
|
core.info("Getting available versions from GitHub API...");
|
||||||
try {
|
try {
|
||||||
const octokit = new octokit_1.Octokit({
|
const octokit = new octokit_1.Octokit({
|
||||||
@@ -96010,7 +96044,29 @@ async function getReleaseTagNames(octokit) {
|
|||||||
return releaseTagNames;
|
return releaseTagNames;
|
||||||
}
|
}
|
||||||
async function getLatestVersion(githubToken) {
|
async function getLatestVersion(githubToken) {
|
||||||
core.info("Getting latest version from GitHub API...");
|
// 1. Try remote manifest first (no rate limits, always current)
|
||||||
|
try {
|
||||||
|
core.info("Getting latest version from remote manifest...");
|
||||||
|
const version = await (0, version_manifest_1.getLatestKnownVersion)(version_manifest_1.REMOTE_MANIFEST_URL);
|
||||||
|
core.debug(`Latest version from remote manifest: ${version}`);
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.debug(`Remote manifest lookup failed: ${err}`);
|
||||||
|
}
|
||||||
|
// 2. Try GitHub API (rate limited but up-to-date)
|
||||||
|
try {
|
||||||
|
core.info("Getting latest version from GitHub API...");
|
||||||
|
return await getLatestVersionFromGitHubApi(githubToken);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.debug(`GitHub API lookup failed: ${err}`);
|
||||||
|
}
|
||||||
|
// 3. Fall back to bundled manifest (no network, may be stale)
|
||||||
|
core.info("Getting latest version from bundled manifest...");
|
||||||
|
return await (0, version_manifest_1.getLatestKnownVersion)(undefined);
|
||||||
|
}
|
||||||
|
async function getLatestVersionFromGitHubApi(githubToken) {
|
||||||
const octokit = new octokit_1.Octokit({
|
const octokit = new octokit_1.Octokit({
|
||||||
auth: githubToken,
|
auth: githubToken,
|
||||||
});
|
});
|
||||||
@@ -96113,8 +96169,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.REMOTE_MANIFEST_URL = void 0;
|
||||||
exports.getLatestKnownVersion = getLatestKnownVersion;
|
exports.getLatestKnownVersion = getLatestKnownVersion;
|
||||||
exports.getDownloadUrl = getDownloadUrl;
|
exports.getDownloadUrl = getDownloadUrl;
|
||||||
|
exports.getAvailableVersionsFromManifest = getAvailableVersionsFromManifest;
|
||||||
exports.updateVersionManifest = updateVersionManifest;
|
exports.updateVersionManifest = updateVersionManifest;
|
||||||
const node_fs_1 = __nccwpck_require__(3024);
|
const node_fs_1 = __nccwpck_require__(3024);
|
||||||
const node_path_1 = __nccwpck_require__(6760);
|
const node_path_1 = __nccwpck_require__(6760);
|
||||||
@@ -96122,6 +96180,9 @@ const core = __importStar(__nccwpck_require__(7484));
|
|||||||
const semver = __importStar(__nccwpck_require__(9318));
|
const semver = __importStar(__nccwpck_require__(9318));
|
||||||
const fetch_1 = __nccwpck_require__(3385);
|
const fetch_1 = __nccwpck_require__(3385);
|
||||||
const localManifestFile = (0, node_path_1.join)(__dirname, "..", "..", "version-manifest.json");
|
const localManifestFile = (0, node_path_1.join)(__dirname, "..", "..", "version-manifest.json");
|
||||||
|
exports.REMOTE_MANIFEST_URL = "https://raw.githubusercontent.com/astral-sh/setup-uv/main/version-manifest.json";
|
||||||
|
// Cache for manifest entries to avoid re-fetching
|
||||||
|
const manifestCache = new Map();
|
||||||
async function getLatestKnownVersion(manifestUrl) {
|
async function getLatestKnownVersion(manifestUrl) {
|
||||||
const manifestEntries = await getManifestEntries(manifestUrl);
|
const manifestEntries = await getManifestEntries(manifestUrl);
|
||||||
return manifestEntries.reduce((a, b) => semver.gt(a.version, b.version) ? a : b).version;
|
return manifestEntries.reduce((a, b) => semver.gt(a.version, b.version) ? a : b).version;
|
||||||
@@ -96133,7 +96194,18 @@ async function getDownloadUrl(manifestUrl, version, arch, platform) {
|
|||||||
entry.platform === platform);
|
entry.platform === platform);
|
||||||
return entry ? entry.downloadUrl : undefined;
|
return entry ? entry.downloadUrl : undefined;
|
||||||
}
|
}
|
||||||
|
async function getAvailableVersionsFromManifest(manifestUrl) {
|
||||||
|
const manifestEntries = await getManifestEntries(manifestUrl);
|
||||||
|
return [...new Set(manifestEntries.map((entry) => entry.version))];
|
||||||
|
}
|
||||||
async function getManifestEntries(manifestUrl) {
|
async function getManifestEntries(manifestUrl) {
|
||||||
|
const cacheKey = manifestUrl ?? "local";
|
||||||
|
// Return cached entries if available
|
||||||
|
const cached = manifestCache.get(cacheKey);
|
||||||
|
if (cached !== undefined) {
|
||||||
|
core.debug(`Using cached manifest entries for: ${cacheKey}`);
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
let data;
|
let data;
|
||||||
if (manifestUrl !== undefined) {
|
if (manifestUrl !== undefined) {
|
||||||
core.info(`Fetching manifest-file from: ${manifestUrl}`);
|
core.info(`Fetching manifest-file from: ${manifestUrl}`);
|
||||||
@@ -96144,11 +96216,13 @@ async function getManifestEntries(manifestUrl) {
|
|||||||
data = await response.text();
|
data = await response.text();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info("manifest-file not provided, reading from local file.");
|
core.debug("Reading manifest from local bundled file.");
|
||||||
const fileContent = await node_fs_1.promises.readFile(localManifestFile);
|
const fileContent = await node_fs_1.promises.readFile(localManifestFile);
|
||||||
data = fileContent.toString();
|
data = fileContent.toString();
|
||||||
}
|
}
|
||||||
return JSON.parse(data);
|
const entries = JSON.parse(data);
|
||||||
|
manifestCache.set(cacheKey, entries);
|
||||||
|
return entries;
|
||||||
}
|
}
|
||||||
async function updateVersionManifest(manifestUrl, downloadUrls) {
|
async function updateVersionManifest(manifestUrl, downloadUrls) {
|
||||||
const manifest = [];
|
const manifest = [];
|
||||||
|
|||||||
22
dist/update-known-versions/index.js
generated
vendored
22
dist/update-known-versions/index.js
generated
vendored
@@ -32482,8 +32482,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.REMOTE_MANIFEST_URL = void 0;
|
||||||
exports.getLatestKnownVersion = getLatestKnownVersion;
|
exports.getLatestKnownVersion = getLatestKnownVersion;
|
||||||
exports.getDownloadUrl = getDownloadUrl;
|
exports.getDownloadUrl = getDownloadUrl;
|
||||||
|
exports.getAvailableVersionsFromManifest = getAvailableVersionsFromManifest;
|
||||||
exports.updateVersionManifest = updateVersionManifest;
|
exports.updateVersionManifest = updateVersionManifest;
|
||||||
const node_fs_1 = __nccwpck_require__(3024);
|
const node_fs_1 = __nccwpck_require__(3024);
|
||||||
const node_path_1 = __nccwpck_require__(6760);
|
const node_path_1 = __nccwpck_require__(6760);
|
||||||
@@ -32491,6 +32493,9 @@ const core = __importStar(__nccwpck_require__(7484));
|
|||||||
const semver = __importStar(__nccwpck_require__(9318));
|
const semver = __importStar(__nccwpck_require__(9318));
|
||||||
const fetch_1 = __nccwpck_require__(3385);
|
const fetch_1 = __nccwpck_require__(3385);
|
||||||
const localManifestFile = (0, node_path_1.join)(__dirname, "..", "..", "version-manifest.json");
|
const localManifestFile = (0, node_path_1.join)(__dirname, "..", "..", "version-manifest.json");
|
||||||
|
exports.REMOTE_MANIFEST_URL = "https://raw.githubusercontent.com/astral-sh/setup-uv/main/version-manifest.json";
|
||||||
|
// Cache for manifest entries to avoid re-fetching
|
||||||
|
const manifestCache = new Map();
|
||||||
async function getLatestKnownVersion(manifestUrl) {
|
async function getLatestKnownVersion(manifestUrl) {
|
||||||
const manifestEntries = await getManifestEntries(manifestUrl);
|
const manifestEntries = await getManifestEntries(manifestUrl);
|
||||||
return manifestEntries.reduce((a, b) => semver.gt(a.version, b.version) ? a : b).version;
|
return manifestEntries.reduce((a, b) => semver.gt(a.version, b.version) ? a : b).version;
|
||||||
@@ -32502,7 +32507,18 @@ async function getDownloadUrl(manifestUrl, version, arch, platform) {
|
|||||||
entry.platform === platform);
|
entry.platform === platform);
|
||||||
return entry ? entry.downloadUrl : undefined;
|
return entry ? entry.downloadUrl : undefined;
|
||||||
}
|
}
|
||||||
|
async function getAvailableVersionsFromManifest(manifestUrl) {
|
||||||
|
const manifestEntries = await getManifestEntries(manifestUrl);
|
||||||
|
return [...new Set(manifestEntries.map((entry) => entry.version))];
|
||||||
|
}
|
||||||
async function getManifestEntries(manifestUrl) {
|
async function getManifestEntries(manifestUrl) {
|
||||||
|
const cacheKey = manifestUrl ?? "local";
|
||||||
|
// Return cached entries if available
|
||||||
|
const cached = manifestCache.get(cacheKey);
|
||||||
|
if (cached !== undefined) {
|
||||||
|
core.debug(`Using cached manifest entries for: ${cacheKey}`);
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
let data;
|
let data;
|
||||||
if (manifestUrl !== undefined) {
|
if (manifestUrl !== undefined) {
|
||||||
core.info(`Fetching manifest-file from: ${manifestUrl}`);
|
core.info(`Fetching manifest-file from: ${manifestUrl}`);
|
||||||
@@ -32513,11 +32529,13 @@ async function getManifestEntries(manifestUrl) {
|
|||||||
data = await response.text();
|
data = await response.text();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info("manifest-file not provided, reading from local file.");
|
core.debug("Reading manifest from local bundled file.");
|
||||||
const fileContent = await node_fs_1.promises.readFile(localManifestFile);
|
const fileContent = await node_fs_1.promises.readFile(localManifestFile);
|
||||||
data = fileContent.toString();
|
data = fileContent.toString();
|
||||||
}
|
}
|
||||||
return JSON.parse(data);
|
const entries = JSON.parse(data);
|
||||||
|
manifestCache.set(cacheKey, entries);
|
||||||
|
return entries;
|
||||||
}
|
}
|
||||||
async function updateVersionManifest(manifestUrl, downloadUrls) {
|
async function updateVersionManifest(manifestUrl, downloadUrls) {
|
||||||
const manifest = [];
|
const manifest = [];
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ import { Octokit } from "../utils/octokit";
|
|||||||
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 {
|
||||||
|
getAvailableVersionsFromManifest,
|
||||||
getDownloadUrl,
|
getDownloadUrl,
|
||||||
getLatestKnownVersion as getLatestVersionInManifest,
|
getLatestKnownVersion as getLatestVersionInManifest,
|
||||||
|
REMOTE_MANIFEST_URL,
|
||||||
} from "./version-manifest";
|
} from "./version-manifest";
|
||||||
|
|
||||||
type Release =
|
type Release =
|
||||||
@@ -61,27 +63,36 @@ export async function downloadVersionFromManifest(
|
|||||||
checkSum: string | undefined,
|
checkSum: string | undefined,
|
||||||
githubToken: string,
|
githubToken: string,
|
||||||
): Promise<{ version: string; cachedToolDir: string }> {
|
): Promise<{ version: string; cachedToolDir: string }> {
|
||||||
const downloadUrl = await getDownloadUrl(
|
// If no user-provided manifest, try remote manifest first (will use cache if already fetched)
|
||||||
manifestUrl,
|
// then fall back to bundled manifest
|
||||||
version,
|
const manifestSources =
|
||||||
arch,
|
manifestUrl !== undefined
|
||||||
platform,
|
? [manifestUrl]
|
||||||
);
|
: [REMOTE_MANIFEST_URL, undefined];
|
||||||
if (!downloadUrl) {
|
|
||||||
core.info(
|
for (const source of manifestSources) {
|
||||||
`manifest-file does not contain version ${version}, arch ${arch}, platform ${platform}. Falling back to GitHub releases.`,
|
try {
|
||||||
);
|
const downloadUrl = await getDownloadUrl(source, version, arch, platform);
|
||||||
return await downloadVersionFromGithub(
|
if (downloadUrl) {
|
||||||
platform,
|
return await downloadVersion(
|
||||||
arch,
|
downloadUrl,
|
||||||
version,
|
`uv-${arch}-${platform}`,
|
||||||
checkSum,
|
platform,
|
||||||
githubToken,
|
arch,
|
||||||
);
|
version,
|
||||||
|
checkSum,
|
||||||
|
githubToken,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
core.debug(`Failed to get download URL from manifest ${source}: ${err}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return await downloadVersion(
|
|
||||||
downloadUrl,
|
core.info(
|
||||||
`uv-${arch}-${platform}`,
|
`Manifest does not contain version ${version}, arch ${arch}, platform ${platform}. Falling back to GitHub releases.`,
|
||||||
|
);
|
||||||
|
return await downloadVersionFromGithub(
|
||||||
platform,
|
platform,
|
||||||
arch,
|
arch,
|
||||||
version,
|
version,
|
||||||
@@ -188,6 +199,32 @@ export async function resolveVersion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getAvailableVersions(githubToken: string): Promise<string[]> {
|
async function getAvailableVersions(githubToken: string): Promise<string[]> {
|
||||||
|
// 1. Try remote manifest first (no rate limits, always current)
|
||||||
|
try {
|
||||||
|
core.info("Getting available versions from remote manifest...");
|
||||||
|
const versions =
|
||||||
|
await getAvailableVersionsFromManifest(REMOTE_MANIFEST_URL);
|
||||||
|
core.debug(`Found ${versions.length} versions from remote manifest`);
|
||||||
|
return versions;
|
||||||
|
} catch (err) {
|
||||||
|
core.debug(`Remote manifest lookup failed: ${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Try GitHub API (rate limited but up-to-date)
|
||||||
|
try {
|
||||||
|
return await getAvailableVersionsFromGitHubApi(githubToken);
|
||||||
|
} catch (err) {
|
||||||
|
core.debug(`GitHub API lookup failed: ${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Fall back to bundled manifest (no network, may be stale)
|
||||||
|
core.info("Getting available versions from bundled manifest...");
|
||||||
|
return await getAvailableVersionsFromManifest(undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getAvailableVersionsFromGitHubApi(
|
||||||
|
githubToken: string,
|
||||||
|
): Promise<string[]> {
|
||||||
core.info("Getting available versions from GitHub API...");
|
core.info("Getting available versions from GitHub API...");
|
||||||
try {
|
try {
|
||||||
const octokit = new Octokit({
|
const octokit = new Octokit({
|
||||||
@@ -224,7 +261,32 @@ async function getReleaseTagNames(octokit: Octokit): Promise<string[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getLatestVersion(githubToken: string) {
|
async function getLatestVersion(githubToken: string) {
|
||||||
core.info("Getting latest version from GitHub API...");
|
// 1. Try remote manifest first (no rate limits, always current)
|
||||||
|
try {
|
||||||
|
core.info("Getting latest version from remote manifest...");
|
||||||
|
const version = await getLatestVersionInManifest(REMOTE_MANIFEST_URL);
|
||||||
|
core.debug(`Latest version from remote manifest: ${version}`);
|
||||||
|
return version;
|
||||||
|
} catch (err) {
|
||||||
|
core.debug(`Remote manifest lookup failed: ${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Try GitHub API (rate limited but up-to-date)
|
||||||
|
try {
|
||||||
|
core.info("Getting latest version from GitHub API...");
|
||||||
|
return await getLatestVersionFromGitHubApi(githubToken);
|
||||||
|
} catch (err) {
|
||||||
|
core.debug(`GitHub API lookup failed: ${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Fall back to bundled manifest (no network, may be stale)
|
||||||
|
core.info("Getting latest version from bundled manifest...");
|
||||||
|
return await getLatestVersionInManifest(undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getLatestVersionFromGitHubApi(
|
||||||
|
githubToken: string,
|
||||||
|
): Promise<string> {
|
||||||
const octokit = new Octokit({
|
const octokit = new Octokit({
|
||||||
auth: githubToken,
|
auth: githubToken,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ import * as semver from "semver";
|
|||||||
import { fetch } from "../utils/fetch";
|
import { fetch } from "../utils/fetch";
|
||||||
|
|
||||||
const localManifestFile = join(__dirname, "..", "..", "version-manifest.json");
|
const localManifestFile = join(__dirname, "..", "..", "version-manifest.json");
|
||||||
|
export const REMOTE_MANIFEST_URL =
|
||||||
|
"https://raw.githubusercontent.com/astral-sh/setup-uv/main/version-manifest.json";
|
||||||
|
|
||||||
|
// Cache for manifest entries to avoid re-fetching
|
||||||
|
const manifestCache = new Map<string, ManifestEntry[]>();
|
||||||
|
|
||||||
interface ManifestEntry {
|
interface ManifestEntry {
|
||||||
version: string;
|
version: string;
|
||||||
@@ -39,9 +44,25 @@ export async function getDownloadUrl(
|
|||||||
return entry ? entry.downloadUrl : undefined;
|
return entry ? entry.downloadUrl : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getAvailableVersionsFromManifest(
|
||||||
|
manifestUrl: string | undefined,
|
||||||
|
): Promise<string[]> {
|
||||||
|
const manifestEntries = await getManifestEntries(manifestUrl);
|
||||||
|
return [...new Set(manifestEntries.map((entry) => entry.version))];
|
||||||
|
}
|
||||||
|
|
||||||
async function getManifestEntries(
|
async function getManifestEntries(
|
||||||
manifestUrl: string | undefined,
|
manifestUrl: string | undefined,
|
||||||
): Promise<ManifestEntry[]> {
|
): Promise<ManifestEntry[]> {
|
||||||
|
const cacheKey = manifestUrl ?? "local";
|
||||||
|
|
||||||
|
// Return cached entries if available
|
||||||
|
const cached = manifestCache.get(cacheKey);
|
||||||
|
if (cached !== undefined) {
|
||||||
|
core.debug(`Using cached manifest entries for: ${cacheKey}`);
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
let data: string;
|
let data: string;
|
||||||
if (manifestUrl !== undefined) {
|
if (manifestUrl !== undefined) {
|
||||||
core.info(`Fetching manifest-file from: ${manifestUrl}`);
|
core.info(`Fetching manifest-file from: ${manifestUrl}`);
|
||||||
@@ -58,7 +79,9 @@ async function getManifestEntries(
|
|||||||
data = fileContent.toString();
|
data = fileContent.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return JSON.parse(data);
|
const entries: ManifestEntry[] = JSON.parse(data);
|
||||||
|
manifestCache.set(cacheKey, entries);
|
||||||
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateVersionManifest(
|
export async function updateVersionManifest(
|
||||||
|
|||||||
Reference in New Issue
Block a user