Skip to content

Commit

Permalink
Add input python-version
Browse files Browse the repository at this point in the history
  • Loading branch information
eifinger committed Nov 28, 2024
1 parent 9839fa9 commit f5fe5c1
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
62 changes: 62 additions & 0 deletions dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/download/download-uv-python.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as exec from "@actions/exec";

export async function downloadUvPython(pythonVersion: string) {
const options: exec.ExecOptions = {
silent: false,
};
const execArgs = ["python", "install", pythonVersion];
await exec.exec("uv", execArgs, options);
}
8 changes: 8 additions & 0 deletions src/setup-uv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
toolDir,
version,
} from "./utils/inputs";
import { downloadUvPython } from "./download/download-uv-python";

async function run(): Promise<void> {
const platform = getPlatform();
Expand All @@ -45,6 +46,7 @@ async function run(): Promise<void> {
addUvToPath(setupResult.uvDir);
addToolBinToPath();
setToolDir();
setupPython();
core.setOutput("uv-version", setupResult.version);
core.info(`Successfully installed uv version ${setupResult.version}`);

Expand Down Expand Up @@ -133,6 +135,12 @@ function setToolDir(): void {
}
}

async function setupPython(): Promise<void> {
await downloadUvPython("3.12");
core.exportVariable("UV_PYTHON", "3.12");
core.info("Set UV_PYTHON to 3.12");
}

function setCacheDir(cacheLocalPath: string): void {
core.exportVariable("UV_CACHE_DIR", cacheLocalPath);
core.info(`Set UV_CACHE_DIR to ${cacheLocalPath}`);
Expand Down

0 comments on commit f5fe5c1

Please sign in to comment.