mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-01-22 11:42:15 +00:00
Compare commits
5 Commits
dependabot
...
zsol/jj-uq
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71191068af | ||
|
|
450788bda3 | ||
|
|
9cfd029643 | ||
|
|
dd9d55bc18 | ||
|
|
8512ad0289 |
@@ -202,7 +202,8 @@ by name (`uv`).
|
||||
With `setup-uv`, you can install a specific version of Python using `uv python install` rather than
|
||||
relying on `actions/setup-python`.
|
||||
|
||||
Using `actions/setup-python` can be faster, because GitHub caches the Python versions alongside the runner.
|
||||
Using `actions/setup-python` can be faster (~1s), because GitHub includes several Python versions in the runner image
|
||||
which are available to get activated by `actions/setup-python` without having to download them.
|
||||
|
||||
For example:
|
||||
|
||||
|
||||
5120
dist/save-cache/index.js
generated
vendored
5120
dist/save-cache/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
9498
dist/setup/index.js
generated
vendored
9498
dist/setup/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
56
dist/update-known-versions/index.js
generated
vendored
56
dist/update-known-versions/index.js
generated
vendored
@@ -28196,6 +28196,42 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.KNOWN_CHECKSUMS = void 0;
|
||||
// AUTOGENERATED_DO_NOT_EDIT
|
||||
exports.KNOWN_CHECKSUMS = {
|
||||
"aarch64-apple-darwin-0.9.26": "fcf0a9ea6599c6ae28a4c854ac6da76f2c889354d7c36ce136ef071f7ab9721f",
|
||||
"aarch64-pc-windows-msvc-0.9.26": "79e1398ec98681b1b0494ed3485b0f4565e98a7db109a3f205d0fcdc6a1992f7",
|
||||
"aarch64-unknown-linux-gnu-0.9.26": "f71040c59798f79c44c08a7a1c1af7de95a8d334ea924b47b67ad6b9632be270",
|
||||
"aarch64-unknown-linux-musl-0.9.26": "ba8698c36c00c22efed4bd3506339b03c95604d001f02eaf6fbc814c9224d801",
|
||||
"arm-unknown-linux-musleabihf-0.9.26": "8baa850e6f7a4f8edeef411891780161e95682bf291c85405fdc331925c425c2",
|
||||
"armv7-unknown-linux-gnueabihf-0.9.26": "f9cf9806b3bd434b4aca5de1a8412502a29bcbc908848cdea18e32480964ab79",
|
||||
"armv7-unknown-linux-musleabihf-0.9.26": "881df52998da192f0609be37abe445ab0d89f28daceecb171ea8a14088153aee",
|
||||
"i686-pc-windows-msvc-0.9.26": "2fa5e36d7dc3053962a95a2583b2bcc19aab2ec6c5d4c887cca58de819cf77dd",
|
||||
"i686-unknown-linux-gnu-0.9.26": "03548a2abd1d604724c9d65184b506d3eafef1b0a7d8cea974a083f5f9c9496f",
|
||||
"i686-unknown-linux-musl-0.9.26": "5208601b9baee1a04a604f441bd94a1ab91b511f142b27729b073f4286994f8f",
|
||||
"powerpc64-unknown-linux-gnu-0.9.26": "6ac6baa2dd7db742ff58a2d54e3fc09693e69c878666bcacf9d49bc58decc98a",
|
||||
"powerpc64le-unknown-linux-gnu-0.9.26": "1a7fbd268b7520e03747022f879113545a5bd71cad02e9cbabd591b268b5a36c",
|
||||
"riscv64gc-unknown-linux-gnu-0.9.26": "9f202ad04cc398dc77a6efe20ea91ec044ad66e1f7a60777e6efd20a357f479a",
|
||||
"s390x-unknown-linux-gnu-0.9.26": "f8e6b8f1264821add1ea21d592b4522300401f44ac4124fba9fea6874fd79797",
|
||||
"x86_64-apple-darwin-0.9.26": "171eb8c518313e157c5b4cec7b4f743bc6bab1bd23e09b646679a02d096a047f",
|
||||
"x86_64-pc-windows-msvc-0.9.26": "eb02fd95d8e0eed462b4a67ecdd320d865b38c560bffcda9a0b87ec944bdf036",
|
||||
"x86_64-unknown-linux-gnu-0.9.26": "30ccbf0a66dc8727a02b0e245c583ee970bdafecf3a443c1686e1b30ec4939e8",
|
||||
"x86_64-unknown-linux-musl-0.9.26": "708b752876aeeb753257e1d55470569789e465684c1d3bc1760db26360b6c28b",
|
||||
"aarch64-apple-darwin-0.9.25": "606b3c6949d971709f2526fa0d9f0fd23ccf60e09f117999b406b424af18a6a6",
|
||||
"aarch64-pc-windows-msvc-0.9.25": "6a4c2a753a94d9639725b435f5d1a65bfa25cd196d448ad60841f5fe81ef0052",
|
||||
"aarch64-unknown-linux-gnu-0.9.25": "a8f1d71a42c4470251a880348b2d28d530018693324175084fa1749d267c98c6",
|
||||
"aarch64-unknown-linux-musl-0.9.25": "11cddffc61826e3b7af02db37bc3ed8e9e6747dad328d45c8b02f89408afbf75",
|
||||
"arm-unknown-linux-musleabihf-0.9.25": "52f3a96605a7873ec44bb84c33ee08e717df61136fec121f715871cae5b779ec",
|
||||
"armv7-unknown-linux-gnueabihf-0.9.25": "7ae274742a5b2398bd75f9075536c7f0b3f99ebc8c6588c37e3bfcd9cc9d781d",
|
||||
"armv7-unknown-linux-musleabihf-0.9.25": "77220a539dfffe576cdc9b9e9ab5432c07dd1b63915c859c227883af7ba00538",
|
||||
"i686-pc-windows-msvc-0.9.25": "55dbf32074a76e029410620e7e3fbef9762799c7dfcf539b098ccc0a64cac9a3",
|
||||
"i686-unknown-linux-gnu-0.9.25": "b9dae29f4e37bc89e69836e59169a51d8cac4da118b7548a20b2269b19c94cad",
|
||||
"i686-unknown-linux-musl-0.9.25": "a84a159856a0227c273e86594d9cf8fbf84c56bd4eeeb9a665c946304c49dbec",
|
||||
"powerpc64-unknown-linux-gnu-0.9.25": "37bc519ebe5e4efb12fd155eb94512547a874f0e41251203b49d715f75eb5a20",
|
||||
"powerpc64le-unknown-linux-gnu-0.9.25": "a01a273b5cd64ece96d4589afbacaf5e99a0695f37ebe9a72fd6b2f7cf0a7071",
|
||||
"riscv64gc-unknown-linux-gnu-0.9.25": "9d9692f1bd5ff6d9db2c4bffc4ceeb8d8746ae03ddeca0b24a0f8fc9ea81b911",
|
||||
"s390x-unknown-linux-gnu-0.9.25": "92d5e4504ef83f421a841381678f871bf2a8821a69d3374dd638e2014d4762ab",
|
||||
"x86_64-apple-darwin-0.9.25": "4982dfff14b3548bc85d0fa0abec6ab8ae62836b218bf1223741ba1392ef93bf",
|
||||
"x86_64-pc-windows-msvc-0.9.25": "d63f8e59cf76bcce9cb8a3eac6c1a89adce0f89a29bacca978c9bf842f419277",
|
||||
"x86_64-unknown-linux-gnu-0.9.25": "fa1f4abfe101d43e820342210c3c6854028703770f81e95b119ed1e65ec81b35",
|
||||
"x86_64-unknown-linux-musl-0.9.25": "700776c376ce36ed5b731fcd699e141d897551f5111907987b63897e0c1ad797",
|
||||
"aarch64-apple-darwin-0.9.24": "89661d9a16682197086df54bb43d0b03e58e23d4d9360fc8c6c0166f2828fd71",
|
||||
"aarch64-pc-windows-msvc-0.9.24": "40ceb66af2667fc9b4d30a65ad8b8795d4effc39a44019b4218ad03f8f1d5a14",
|
||||
"aarch64-unknown-linux-gnu-0.9.24": "9b291a1a4f2fefc430e4fc49c00cb93eb448d41c5c79edf45211ceffedde3334",
|
||||
@@ -32446,8 +32482,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.REMOTE_MANIFEST_URL = void 0;
|
||||
exports.getLatestKnownVersion = getLatestKnownVersion;
|
||||
exports.getDownloadUrl = getDownloadUrl;
|
||||
exports.getAvailableVersionsFromManifest = getAvailableVersionsFromManifest;
|
||||
exports.updateVersionManifest = updateVersionManifest;
|
||||
const node_fs_1 = __nccwpck_require__(3024);
|
||||
const node_path_1 = __nccwpck_require__(6760);
|
||||
@@ -32455,6 +32493,9 @@ const core = __importStar(__nccwpck_require__(7484));
|
||||
const semver = __importStar(__nccwpck_require__(9318));
|
||||
const fetch_1 = __nccwpck_require__(3385);
|
||||
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) {
|
||||
const manifestEntries = await getManifestEntries(manifestUrl);
|
||||
return manifestEntries.reduce((a, b) => semver.gt(a.version, b.version) ? a : b).version;
|
||||
@@ -32466,7 +32507,18 @@ async function getDownloadUrl(manifestUrl, version, arch, platform) {
|
||||
entry.platform === platform);
|
||||
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) {
|
||||
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;
|
||||
if (manifestUrl !== undefined) {
|
||||
core.info(`Fetching manifest-file from: ${manifestUrl}`);
|
||||
@@ -32481,7 +32533,9 @@ async function getManifestEntries(manifestUrl) {
|
||||
const fileContent = await node_fs_1.promises.readFile(localManifestFile);
|
||||
data = fileContent.toString();
|
||||
}
|
||||
return JSON.parse(data);
|
||||
const entries = JSON.parse(data);
|
||||
manifestCache.set(cacheKey, entries);
|
||||
return entries;
|
||||
}
|
||||
async function updateVersionManifest(manifestUrl, downloadUrls) {
|
||||
const manifest = [];
|
||||
|
||||
@@ -1,5 +1,77 @@
|
||||
// AUTOGENERATED_DO_NOT_EDIT
|
||||
export const KNOWN_CHECKSUMS: { [key: string]: string } = {
|
||||
"aarch64-apple-darwin-0.9.26":
|
||||
"fcf0a9ea6599c6ae28a4c854ac6da76f2c889354d7c36ce136ef071f7ab9721f",
|
||||
"aarch64-pc-windows-msvc-0.9.26":
|
||||
"79e1398ec98681b1b0494ed3485b0f4565e98a7db109a3f205d0fcdc6a1992f7",
|
||||
"aarch64-unknown-linux-gnu-0.9.26":
|
||||
"f71040c59798f79c44c08a7a1c1af7de95a8d334ea924b47b67ad6b9632be270",
|
||||
"aarch64-unknown-linux-musl-0.9.26":
|
||||
"ba8698c36c00c22efed4bd3506339b03c95604d001f02eaf6fbc814c9224d801",
|
||||
"arm-unknown-linux-musleabihf-0.9.26":
|
||||
"8baa850e6f7a4f8edeef411891780161e95682bf291c85405fdc331925c425c2",
|
||||
"armv7-unknown-linux-gnueabihf-0.9.26":
|
||||
"f9cf9806b3bd434b4aca5de1a8412502a29bcbc908848cdea18e32480964ab79",
|
||||
"armv7-unknown-linux-musleabihf-0.9.26":
|
||||
"881df52998da192f0609be37abe445ab0d89f28daceecb171ea8a14088153aee",
|
||||
"i686-pc-windows-msvc-0.9.26":
|
||||
"2fa5e36d7dc3053962a95a2583b2bcc19aab2ec6c5d4c887cca58de819cf77dd",
|
||||
"i686-unknown-linux-gnu-0.9.26":
|
||||
"03548a2abd1d604724c9d65184b506d3eafef1b0a7d8cea974a083f5f9c9496f",
|
||||
"i686-unknown-linux-musl-0.9.26":
|
||||
"5208601b9baee1a04a604f441bd94a1ab91b511f142b27729b073f4286994f8f",
|
||||
"powerpc64-unknown-linux-gnu-0.9.26":
|
||||
"6ac6baa2dd7db742ff58a2d54e3fc09693e69c878666bcacf9d49bc58decc98a",
|
||||
"powerpc64le-unknown-linux-gnu-0.9.26":
|
||||
"1a7fbd268b7520e03747022f879113545a5bd71cad02e9cbabd591b268b5a36c",
|
||||
"riscv64gc-unknown-linux-gnu-0.9.26":
|
||||
"9f202ad04cc398dc77a6efe20ea91ec044ad66e1f7a60777e6efd20a357f479a",
|
||||
"s390x-unknown-linux-gnu-0.9.26":
|
||||
"f8e6b8f1264821add1ea21d592b4522300401f44ac4124fba9fea6874fd79797",
|
||||
"x86_64-apple-darwin-0.9.26":
|
||||
"171eb8c518313e157c5b4cec7b4f743bc6bab1bd23e09b646679a02d096a047f",
|
||||
"x86_64-pc-windows-msvc-0.9.26":
|
||||
"eb02fd95d8e0eed462b4a67ecdd320d865b38c560bffcda9a0b87ec944bdf036",
|
||||
"x86_64-unknown-linux-gnu-0.9.26":
|
||||
"30ccbf0a66dc8727a02b0e245c583ee970bdafecf3a443c1686e1b30ec4939e8",
|
||||
"x86_64-unknown-linux-musl-0.9.26":
|
||||
"708b752876aeeb753257e1d55470569789e465684c1d3bc1760db26360b6c28b",
|
||||
"aarch64-apple-darwin-0.9.25":
|
||||
"606b3c6949d971709f2526fa0d9f0fd23ccf60e09f117999b406b424af18a6a6",
|
||||
"aarch64-pc-windows-msvc-0.9.25":
|
||||
"6a4c2a753a94d9639725b435f5d1a65bfa25cd196d448ad60841f5fe81ef0052",
|
||||
"aarch64-unknown-linux-gnu-0.9.25":
|
||||
"a8f1d71a42c4470251a880348b2d28d530018693324175084fa1749d267c98c6",
|
||||
"aarch64-unknown-linux-musl-0.9.25":
|
||||
"11cddffc61826e3b7af02db37bc3ed8e9e6747dad328d45c8b02f89408afbf75",
|
||||
"arm-unknown-linux-musleabihf-0.9.25":
|
||||
"52f3a96605a7873ec44bb84c33ee08e717df61136fec121f715871cae5b779ec",
|
||||
"armv7-unknown-linux-gnueabihf-0.9.25":
|
||||
"7ae274742a5b2398bd75f9075536c7f0b3f99ebc8c6588c37e3bfcd9cc9d781d",
|
||||
"armv7-unknown-linux-musleabihf-0.9.25":
|
||||
"77220a539dfffe576cdc9b9e9ab5432c07dd1b63915c859c227883af7ba00538",
|
||||
"i686-pc-windows-msvc-0.9.25":
|
||||
"55dbf32074a76e029410620e7e3fbef9762799c7dfcf539b098ccc0a64cac9a3",
|
||||
"i686-unknown-linux-gnu-0.9.25":
|
||||
"b9dae29f4e37bc89e69836e59169a51d8cac4da118b7548a20b2269b19c94cad",
|
||||
"i686-unknown-linux-musl-0.9.25":
|
||||
"a84a159856a0227c273e86594d9cf8fbf84c56bd4eeeb9a665c946304c49dbec",
|
||||
"powerpc64-unknown-linux-gnu-0.9.25":
|
||||
"37bc519ebe5e4efb12fd155eb94512547a874f0e41251203b49d715f75eb5a20",
|
||||
"powerpc64le-unknown-linux-gnu-0.9.25":
|
||||
"a01a273b5cd64ece96d4589afbacaf5e99a0695f37ebe9a72fd6b2f7cf0a7071",
|
||||
"riscv64gc-unknown-linux-gnu-0.9.25":
|
||||
"9d9692f1bd5ff6d9db2c4bffc4ceeb8d8746ae03ddeca0b24a0f8fc9ea81b911",
|
||||
"s390x-unknown-linux-gnu-0.9.25":
|
||||
"92d5e4504ef83f421a841381678f871bf2a8821a69d3374dd638e2014d4762ab",
|
||||
"x86_64-apple-darwin-0.9.25":
|
||||
"4982dfff14b3548bc85d0fa0abec6ab8ae62836b218bf1223741ba1392ef93bf",
|
||||
"x86_64-pc-windows-msvc-0.9.25":
|
||||
"d63f8e59cf76bcce9cb8a3eac6c1a89adce0f89a29bacca978c9bf842f419277",
|
||||
"x86_64-unknown-linux-gnu-0.9.25":
|
||||
"fa1f4abfe101d43e820342210c3c6854028703770f81e95b119ed1e65ec81b35",
|
||||
"x86_64-unknown-linux-musl-0.9.25":
|
||||
"700776c376ce36ed5b731fcd699e141d897551f5111907987b63897e0c1ad797",
|
||||
"aarch64-apple-darwin-0.9.24":
|
||||
"89661d9a16682197086df54bb43d0b03e58e23d4d9360fc8c6c0166f2828fd71",
|
||||
"aarch64-pc-windows-msvc-0.9.24":
|
||||
|
||||
@@ -2,21 +2,18 @@ import { promises as fs } from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import * as core from "@actions/core";
|
||||
import * as tc from "@actions/tool-cache";
|
||||
import type { Endpoints } from "@octokit/types";
|
||||
import * as pep440 from "@renovatebot/pep440";
|
||||
import * as semver from "semver";
|
||||
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
|
||||
import { Octokit } from "../utils/octokit";
|
||||
import type { Architecture, Platform } from "../utils/platforms";
|
||||
import { validateChecksum } from "./checksum/checksum";
|
||||
import {
|
||||
getAvailableVersionsFromManifest,
|
||||
getDownloadUrl,
|
||||
getLatestKnownVersion as getLatestVersionInManifest,
|
||||
REMOTE_MANIFEST_URL,
|
||||
} from "./version-manifest";
|
||||
|
||||
type Release =
|
||||
Endpoints["GET /repos/{owner}/{repo}/releases"]["response"]["data"][number];
|
||||
|
||||
export function tryGetFromToolCache(
|
||||
arch: Architecture,
|
||||
version: string,
|
||||
@@ -61,27 +58,36 @@ export async function downloadVersionFromManifest(
|
||||
checkSum: string | undefined,
|
||||
githubToken: string,
|
||||
): Promise<{ version: string; cachedToolDir: string }> {
|
||||
const downloadUrl = await getDownloadUrl(
|
||||
manifestUrl,
|
||||
version,
|
||||
arch,
|
||||
platform,
|
||||
);
|
||||
if (!downloadUrl) {
|
||||
core.info(
|
||||
`manifest-file does not contain version ${version}, arch ${arch}, platform ${platform}. Falling back to GitHub releases.`,
|
||||
);
|
||||
return await downloadVersionFromGithub(
|
||||
platform,
|
||||
arch,
|
||||
version,
|
||||
checkSum,
|
||||
githubToken,
|
||||
);
|
||||
// If no user-provided manifest, try remote manifest first (will use cache if already fetched)
|
||||
// then fall back to bundled manifest
|
||||
const manifestSources =
|
||||
manifestUrl !== undefined
|
||||
? [manifestUrl]
|
||||
: [REMOTE_MANIFEST_URL, undefined];
|
||||
|
||||
for (const source of manifestSources) {
|
||||
try {
|
||||
const downloadUrl = await 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}`,
|
||||
|
||||
core.info(
|
||||
`Manifest does not contain version ${version}, arch ${arch}, platform ${platform}. Falling back to GitHub releases.`,
|
||||
);
|
||||
return await downloadVersionFromGithub(
|
||||
platform,
|
||||
arch,
|
||||
version,
|
||||
@@ -143,7 +149,6 @@ function getExtension(platform: Platform): string {
|
||||
export async function resolveVersion(
|
||||
versionInput: string,
|
||||
manifestFile: string | undefined,
|
||||
githubToken: string,
|
||||
resolutionStrategy: "highest" | "lowest" = "highest",
|
||||
): Promise<string> {
|
||||
core.debug(`Resolving version: ${versionInput}`);
|
||||
@@ -163,7 +168,7 @@ export async function resolveVersion(
|
||||
} else {
|
||||
version =
|
||||
versionInput === "latest" || resolveVersionSpecifierToLatest
|
||||
? await getLatestVersion(githubToken)
|
||||
? await getLatestVersion()
|
||||
: versionInput;
|
||||
}
|
||||
if (tc.isExplicitVersion(version)) {
|
||||
@@ -175,7 +180,7 @@ export async function resolveVersion(
|
||||
}
|
||||
return version;
|
||||
}
|
||||
const availableVersions = await getAvailableVersions(githubToken);
|
||||
const availableVersions = await getAvailableVersions();
|
||||
core.debug(`Available versions: ${availableVersions}`);
|
||||
const resolvedVersion =
|
||||
resolutionStrategy === "lowest"
|
||||
@@ -187,79 +192,37 @@ export async function resolveVersion(
|
||||
return resolvedVersion;
|
||||
}
|
||||
|
||||
async function getAvailableVersions(githubToken: string): Promise<string[]> {
|
||||
core.info("Getting available versions from GitHub API...");
|
||||
async function getAvailableVersions(): Promise<string[]> {
|
||||
// 1. Try remote manifest first (no rate limits, always current)
|
||||
try {
|
||||
const octokit = new Octokit({
|
||||
auth: githubToken,
|
||||
});
|
||||
return await getReleaseTagNames(octokit);
|
||||
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) {
|
||||
if ((err as Error).message.includes("Bad credentials")) {
|
||||
core.info(
|
||||
"No (valid) GitHub token provided. Falling back to anonymous. Requests might be rate limited.",
|
||||
);
|
||||
const octokit = new Octokit();
|
||||
return await getReleaseTagNames(octokit);
|
||||
}
|
||||
throw err;
|
||||
core.debug(`Remote manifest lookup failed: ${err}`);
|
||||
}
|
||||
|
||||
// 2. Fall back to bundled manifest (no network, may be stale)
|
||||
core.info("Getting available versions from bundled manifest...");
|
||||
return await getAvailableVersionsFromManifest(undefined);
|
||||
}
|
||||
|
||||
async function getReleaseTagNames(octokit: Octokit): Promise<string[]> {
|
||||
const response: Release[] = await octokit.paginate(
|
||||
octokit.rest.repos.listReleases,
|
||||
{
|
||||
owner: OWNER,
|
||||
repo: REPO,
|
||||
},
|
||||
);
|
||||
const releaseTagNames = response.map((release) => release.tag_name);
|
||||
if (releaseTagNames.length === 0) {
|
||||
throw Error(
|
||||
"Github API request failed while getting releases. Check the GitHub status page for outages. Try again later.",
|
||||
);
|
||||
}
|
||||
return releaseTagNames;
|
||||
}
|
||||
|
||||
async function getLatestVersion(githubToken: string) {
|
||||
core.info("Getting latest version from GitHub API...");
|
||||
const octokit = new Octokit({
|
||||
auth: githubToken,
|
||||
});
|
||||
|
||||
let latestRelease: { tag_name: string } | undefined;
|
||||
async function getLatestVersion() {
|
||||
// 1. Try remote manifest first (no rate limits, always current)
|
||||
try {
|
||||
latestRelease = await getLatestRelease(octokit);
|
||||
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) {
|
||||
if ((err as Error).message.includes("Bad credentials")) {
|
||||
core.info(
|
||||
"No (valid) GitHub token provided. Falling back to anonymous. Requests might be rate limited.",
|
||||
);
|
||||
const octokit = new Octokit();
|
||||
latestRelease = await getLatestRelease(octokit);
|
||||
} else {
|
||||
core.error(
|
||||
"Github API request failed while getting latest release. Check the GitHub status page for outages. Try again later.",
|
||||
);
|
||||
throw err;
|
||||
}
|
||||
core.debug(`Remote manifest lookup failed: ${err}`);
|
||||
}
|
||||
|
||||
if (!latestRelease) {
|
||||
throw new Error("Could not determine latest release.");
|
||||
}
|
||||
core.debug(`Latest version: ${latestRelease.tag_name}`);
|
||||
return latestRelease.tag_name;
|
||||
}
|
||||
|
||||
async function getLatestRelease(octokit: Octokit) {
|
||||
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
|
||||
owner: OWNER,
|
||||
repo: REPO,
|
||||
});
|
||||
return latestRelease;
|
||||
// 2. Fall back to bundled manifest (no network, may be stale)
|
||||
core.info("Getting latest version from bundled manifest...");
|
||||
return await getLatestVersionInManifest(undefined);
|
||||
}
|
||||
|
||||
function maxSatisfying(
|
||||
|
||||
@@ -5,6 +5,11 @@ import * as semver from "semver";
|
||||
import { fetch } from "../utils/fetch";
|
||||
|
||||
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 {
|
||||
version: string;
|
||||
@@ -39,9 +44,25 @@ export async function getDownloadUrl(
|
||||
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(
|
||||
manifestUrl: string | undefined,
|
||||
): 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;
|
||||
if (manifestUrl !== undefined) {
|
||||
core.info(`Fetching manifest-file from: ${manifestUrl}`);
|
||||
@@ -58,7 +79,9 @@ async function getManifestEntries(
|
||||
data = fileContent.toString();
|
||||
}
|
||||
|
||||
return JSON.parse(data);
|
||||
const entries: ManifestEntry[] = JSON.parse(data);
|
||||
manifestCache.set(cacheKey, entries);
|
||||
return entries;
|
||||
}
|
||||
|
||||
export async function updateVersionManifest(
|
||||
|
||||
@@ -157,12 +157,7 @@ async function determineVersion(
|
||||
manifestFile: string | undefined,
|
||||
): Promise<string> {
|
||||
if (versionInput !== "") {
|
||||
return await resolveVersion(
|
||||
versionInput,
|
||||
manifestFile,
|
||||
githubToken,
|
||||
resolutionStrategy,
|
||||
);
|
||||
return await resolveVersion(versionInput, manifestFile, resolutionStrategy);
|
||||
}
|
||||
if (versionFileInput !== "") {
|
||||
const versionFromFile = getUvVersionFromFile(versionFileInput);
|
||||
@@ -174,7 +169,6 @@ async function determineVersion(
|
||||
return await resolveVersion(
|
||||
versionFromFile,
|
||||
manifestFile,
|
||||
githubToken,
|
||||
resolutionStrategy,
|
||||
);
|
||||
}
|
||||
@@ -192,7 +186,6 @@ async function determineVersion(
|
||||
return await resolveVersion(
|
||||
versionFromUvToml || versionFromPyproject || "latest",
|
||||
manifestFile,
|
||||
githubToken,
|
||||
resolutionStrategy,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,256 @@
|
||||
[
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-apple-darwin.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-aarch64-apple-darwin.tar.gz",
|
||||
"platform": "apple-darwin",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-pc-windows-msvc.zip",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-aarch64-pc-windows-msvc.zip",
|
||||
"platform": "pc-windows-msvc",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-aarch64-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-unknown-linux-musl.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-aarch64-unknown-linux-musl.tar.gz",
|
||||
"platform": "unknown-linux-musl",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "arm",
|
||||
"artifactName": "uv-arm-unknown-linux-musleabihf.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-arm-unknown-linux-musleabihf.tar.gz",
|
||||
"platform": "unknown-linux-musleabihf",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "armv7",
|
||||
"artifactName": "uv-armv7-unknown-linux-gnueabihf.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-armv7-unknown-linux-gnueabihf.tar.gz",
|
||||
"platform": "unknown-linux-gnueabihf",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "armv7",
|
||||
"artifactName": "uv-armv7-unknown-linux-musleabihf.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-armv7-unknown-linux-musleabihf.tar.gz",
|
||||
"platform": "unknown-linux-musleabihf",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "i686",
|
||||
"artifactName": "uv-i686-pc-windows-msvc.zip",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-i686-pc-windows-msvc.zip",
|
||||
"platform": "pc-windows-msvc",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "i686",
|
||||
"artifactName": "uv-i686-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-i686-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "i686",
|
||||
"artifactName": "uv-i686-unknown-linux-musl.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-i686-unknown-linux-musl.tar.gz",
|
||||
"platform": "unknown-linux-musl",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "powerpc64",
|
||||
"artifactName": "uv-powerpc64-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-powerpc64-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "powerpc64le",
|
||||
"artifactName": "uv-powerpc64le-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-powerpc64le-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "riscv64gc",
|
||||
"artifactName": "uv-riscv64gc-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-riscv64gc-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "s390x",
|
||||
"artifactName": "uv-s390x-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-s390x-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-apple-darwin.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-apple-darwin.tar.gz",
|
||||
"platform": "apple-darwin",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-pc-windows-msvc.zip",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-pc-windows-msvc.zip",
|
||||
"platform": "pc-windows-msvc",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-unknown-linux-musl.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.26/uv-x86_64-unknown-linux-musl.tar.gz",
|
||||
"platform": "unknown-linux-musl",
|
||||
"version": "0.9.26"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-apple-darwin.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-aarch64-apple-darwin.tar.gz",
|
||||
"platform": "apple-darwin",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-pc-windows-msvc.zip",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-aarch64-pc-windows-msvc.zip",
|
||||
"platform": "pc-windows-msvc",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-aarch64-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-unknown-linux-musl.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-aarch64-unknown-linux-musl.tar.gz",
|
||||
"platform": "unknown-linux-musl",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "arm",
|
||||
"artifactName": "uv-arm-unknown-linux-musleabihf.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-arm-unknown-linux-musleabihf.tar.gz",
|
||||
"platform": "unknown-linux-musleabihf",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "armv7",
|
||||
"artifactName": "uv-armv7-unknown-linux-gnueabihf.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-armv7-unknown-linux-gnueabihf.tar.gz",
|
||||
"platform": "unknown-linux-gnueabihf",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "armv7",
|
||||
"artifactName": "uv-armv7-unknown-linux-musleabihf.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-armv7-unknown-linux-musleabihf.tar.gz",
|
||||
"platform": "unknown-linux-musleabihf",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "i686",
|
||||
"artifactName": "uv-i686-pc-windows-msvc.zip",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-i686-pc-windows-msvc.zip",
|
||||
"platform": "pc-windows-msvc",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "i686",
|
||||
"artifactName": "uv-i686-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-i686-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "i686",
|
||||
"artifactName": "uv-i686-unknown-linux-musl.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-i686-unknown-linux-musl.tar.gz",
|
||||
"platform": "unknown-linux-musl",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "powerpc64",
|
||||
"artifactName": "uv-powerpc64-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-powerpc64-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "powerpc64le",
|
||||
"artifactName": "uv-powerpc64le-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-powerpc64le-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "riscv64gc",
|
||||
"artifactName": "uv-riscv64gc-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-riscv64gc-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "s390x",
|
||||
"artifactName": "uv-s390x-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-s390x-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-apple-darwin.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-x86_64-apple-darwin.tar.gz",
|
||||
"platform": "apple-darwin",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-pc-windows-msvc.zip",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-x86_64-pc-windows-msvc.zip",
|
||||
"platform": "pc-windows-msvc",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-x86_64-unknown-linux-gnu.tar.gz",
|
||||
"platform": "unknown-linux-gnu",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "x86_64",
|
||||
"artifactName": "uv-x86_64-unknown-linux-musl.tar.gz",
|
||||
"downloadUrl": "https://github.com/astral-sh/uv/releases/download/0.9.25/uv-x86_64-unknown-linux-musl.tar.gz",
|
||||
"platform": "unknown-linux-musl",
|
||||
"version": "0.9.25"
|
||||
},
|
||||
{
|
||||
"arch": "aarch64",
|
||||
"artifactName": "uv-aarch64-apple-darwin.tar.gz",
|
||||
|
||||
Reference in New Issue
Block a user