mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-06-09 11:30:42 +00:00
feat: add download-from-astral-mirror input (#897)
## Summary Add a new boolean input `download-from-astral-mirror` (default: `true`) that controls whether uv is downloaded from the Astral mirror or directly from GitHub Releases. When set to `false`, the mirror rewrite is skipped entirely and the download goes straight to GitHub Releases. Closes: #870
This commit is contained in:
committed by
GitHub
parent
80cc27528e
commit
b9c8c4c7ba
@@ -36,6 +36,7 @@ export async function downloadVersion(
|
||||
checksum: string | undefined,
|
||||
githubToken: string,
|
||||
manifestUrl?: string,
|
||||
downloadFromAstralMirror = true,
|
||||
): Promise<{ version: string; cachedToolDir: string }> {
|
||||
const artifact = await getArtifact(version, arch, platform, manifestUrl);
|
||||
|
||||
@@ -52,7 +53,9 @@ export async function downloadVersion(
|
||||
? checksum
|
||||
: resolveChecksum(checksum, artifact.checksum);
|
||||
|
||||
const mirrorUrl = rewriteToMirror(artifact.downloadUrl);
|
||||
const mirrorUrl = downloadFromAstralMirror
|
||||
? rewriteToMirror(artifact.downloadUrl)
|
||||
: undefined;
|
||||
const downloadUrl = mirrorUrl ?? artifact.downloadUrl;
|
||||
|
||||
try {
|
||||
|
||||
@@ -154,6 +154,7 @@ async function setupUv(
|
||||
inputs.checksum,
|
||||
inputs.githubToken,
|
||||
inputs.manifestFile,
|
||||
inputs.downloadFromAstralMirror,
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
@@ -40,6 +40,7 @@ export interface SetupInputs {
|
||||
pythonDir: string;
|
||||
githubToken: string;
|
||||
manifestFile?: string;
|
||||
downloadFromAstralMirror: boolean;
|
||||
addProblemMatchers: boolean;
|
||||
resolutionStrategy: ResolutionStrategy;
|
||||
}
|
||||
@@ -73,6 +74,8 @@ export function loadInputs(): SetupInputs {
|
||||
const pythonDir = getUvPythonDir();
|
||||
const githubToken = core.getInput("github-token");
|
||||
const manifestFile = getManifestFile();
|
||||
const downloadFromAstralMirror =
|
||||
core.getInput("download-from-astral-mirror") === "true";
|
||||
const addProblemMatchers = core.getInput("add-problem-matchers") === "true";
|
||||
const resolutionStrategy = getResolutionStrategy();
|
||||
|
||||
@@ -84,6 +87,7 @@ export function loadInputs(): SetupInputs {
|
||||
cachePython,
|
||||
cacheSuffix,
|
||||
checksum,
|
||||
downloadFromAstralMirror,
|
||||
enableCache,
|
||||
githubToken,
|
||||
ignoreEmptyWorkdir,
|
||||
|
||||
Reference in New Issue
Block a user