Add input python-version (#174)

This commit is contained in:
Kevin Stillhammer 2024-11-28 21:41:37 +01:00 committed by GitHub
parent 420915557e
commit ee4fa33003
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 44 additions and 8 deletions

View file

@ -18,6 +18,7 @@ import {
checkSum,
enableCache,
githubToken,
pythonVersion,
toolBinDir,
toolDir,
version,
@ -45,12 +46,13 @@ async function run(): Promise<void> {
addUvToPath(setupResult.uvDir);
addToolBinToPath();
setToolDir();
core.setOutput("uv-version", setupResult.version);
core.info(`Successfully installed uv version ${setupResult.version}`);
setupPython();
addMatchers();
setCacheDir(cacheLocalPath);
core.setOutput("uv-version", setupResult.version);
core.info(`Successfully installed uv version ${setupResult.version}`);
if (enableCache) {
await restoreCache(setupResult.version);
}
@ -133,6 +135,13 @@ function setToolDir(): void {
}
}
function setupPython(): void {
if (pythonVersion !== "") {
core.exportVariable("UV_PYTHON", pythonVersion);
core.info(`Set UV_PYTHON to ${pythonVersion}`);
}
}
function setCacheDir(cacheLocalPath: string): void {
core.exportVariable("UV_CACHE_DIR", cacheLocalPath);
core.info(`Set UV_CACHE_DIR to ${cacheLocalPath}`);

View file

@ -2,6 +2,7 @@ import * as core from "@actions/core";
import path from "node:path";
export const version = core.getInput("version");
export const pythonVersion = core.getInput("python-version");
export const checkSum = core.getInput("checksum");
export const enableCache = core.getInput("enable-cache") === "true";
export const cacheSuffix = core.getInput("cache-suffix") || "";