File tree 7 files changed +44
-8
lines changed
7 files changed +44
-8
lines changed Original file line number Diff line number Diff line change 24
24
- name : Make sure no changes from linters are detected
25
25
run : |
26
26
git diff --exit-code
27
- test-latest -version :
27
+ test-default -version :
28
28
runs-on : ${{ matrix.os }}
29
29
strategy :
30
30
matrix :
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
14
14
- [ Install the latest version (default)] ( #install-the-latest-version-default )
15
15
- [ Install a specific version] ( #install-a-specific-version )
16
16
- [ Install a version by supplying a semver range] ( #install-a-version-by-supplying-a-semver-range )
17
+ - [ Python version] ( #python-version )
17
18
- [ Validate checksum] ( #validate-checksum )
18
19
- [ Enable Caching] ( #enable-caching )
19
20
- [ Cache dependency glob] ( #cache-dependency-glob )
@@ -75,6 +76,19 @@ to install the latest version that satisfies the range.
75
76
version: "0.4.x"
76
77
` ` `
77
78
79
+ # ## Python version
80
+
81
+ You can use the input `python-version` to set the environment variable `UV_PYTHON` for the rest
82
+ of your workflow.
83
+ This will override any python version specifications in `pyproject.toml` and `.python-version`
84
+
85
+ ` ` ` yaml
86
+ - name: Install the latest version of uv and set the python version to 3.12
87
+ uses: astral-sh/setup-uv@v3
88
+ with:
89
+ python-version: "3.12"
90
+ ` ` `
91
+
78
92
# ## Validate checksum
79
93
80
94
You can specify a checksum to validate the downloaded executable. Checksums up to the default version
Original file line number Diff line number Diff line change 6
6
version :
7
7
description : " The version of uv to install"
8
8
default : " latest"
9
+ python-version :
10
+ description : " The version of Python to set UV_PYTHON to"
11
+ required : false
9
12
checksum :
10
13
description : " The checksum of the uv version to install"
11
14
required : false
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
18
18
checkSum ,
19
19
enableCache ,
20
20
githubToken ,
21
+ pythonVersion ,
21
22
toolBinDir ,
22
23
toolDir ,
23
24
version ,
@@ -45,12 +46,13 @@ async function run(): Promise<void> {
45
46
addUvToPath ( setupResult . uvDir ) ;
46
47
addToolBinToPath ( ) ;
47
48
setToolDir ( ) ;
48
- core . setOutput ( "uv-version" , setupResult . version ) ;
49
- core . info ( `Successfully installed uv version ${ setupResult . version } ` ) ;
50
-
49
+ setupPython ( ) ;
51
50
addMatchers ( ) ;
52
51
setCacheDir ( cacheLocalPath ) ;
53
52
53
+ core . setOutput ( "uv-version" , setupResult . version ) ;
54
+ core . info ( `Successfully installed uv version ${ setupResult . version } ` ) ;
55
+
54
56
if ( enableCache ) {
55
57
await restoreCache ( setupResult . version ) ;
56
58
}
@@ -133,6 +135,13 @@ function setToolDir(): void {
133
135
}
134
136
}
135
137
138
+ function setupPython ( ) : void {
139
+ if ( pythonVersion !== "" ) {
140
+ core . exportVariable ( "UV_PYTHON" , pythonVersion ) ;
141
+ core . info ( `Set UV_PYTHON to ${ pythonVersion } ` ) ;
142
+ }
143
+ }
144
+
136
145
function setCacheDir ( cacheLocalPath : string ) : void {
137
146
core . exportVariable ( "UV_CACHE_DIR" , cacheLocalPath ) ;
138
147
core . info ( `Set UV_CACHE_DIR to ${ cacheLocalPath } ` ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as core from "@actions/core";
2
2
import path from "node:path" ;
3
3
4
4
export const version = core . getInput ( "version" ) ;
5
+ export const pythonVersion = core . getInput ( "python-version" ) ;
5
6
export const checkSum = core . getInput ( "checksum" ) ;
6
7
export const enableCache = core . getInput ( "enable-cache" ) === "true" ;
7
8
export const cacheSuffix = core . getInput ( "cache-suffix" ) || "" ;
You can’t perform that action at this time.
0 commit comments