Skip to content

Commit bfebbf8

Browse files
Change default to "latest" (#37)
## Summary Also did some light editing of the README.
1 parent a6cb892 commit bfebbf8

File tree

2 files changed

+34
-42
lines changed

2 files changed

+34
-42
lines changed

README.md

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
Set up your GitHub Actions workflow with a specific version of [uv](https://docs.astral.sh/uv/).
44

5-
- Install a version of uv and add it to the path
5+
- Install a version of uv and add it to PATH
66
- Cache the installed version of uv to speed up consecutive runs on self-hosted runners
77
- Register problem matchers for error output
8-
- Optional: Cache the uv cache
9-
- Optional: Verify the checksum of the downloaded uv executable
8+
- (Optional) Persist the uv's cache in the GitHub Actions Cache
9+
- (Optional) Verify the checksum of the downloaded uv executable
1010

1111
## Contents
1212

@@ -26,33 +26,26 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
2626
Example workflow in a real world project can be found
2727
[here](https://github.com/eifinger/hass-weenect/blob/main/.github/workflows/ci.yml)
2828

29-
### Install specific version
30-
31-
You can also specify a specific version of uv
29+
### Install the latest version (default)
3230

3331
```yaml
34-
- name: Install a specific version
32+
- name: Install the latest version of uv
3533
uses: astral-sh/setup-uv@v1
3634
with:
37-
version: "0.4.4"
35+
version: "latest"
3836
```
3937
40-
### Install latest version
38+
> [!TIP] Using `latest` requires that uv download the executable on every run, which incurs a cost
39+
> (especially on self-hosted runners). As an alternative, consider pinning the version to a specific
40+
> release.
4141

42-
By default this action installs the version defined as `default` in `action.yml`. This gets
43-
automatically updated in a new release of this action when a new version of uv is released. If you
44-
don't want to wait for a new release of this action you can use `version: latest`.
45-
46-
> [!WARNING]
47-
> Using the `latest` version means that the uv executable gets downloaded every single time instead
48-
> of loaded from the tools cache. This can take up to 20s depending on the download speed. This does
49-
> not affect the uv cache.
42+
### Install a specific version
5043

5144
```yaml
52-
- name: Install a specific version
45+
- name: Install a specific version of uv
5346
uses: astral-sh/setup-uv@v1
5447
with:
55-
version: "latest"
48+
version: "0.4.4"
5649
```
5750

5851
### Validate checksum
@@ -71,9 +64,9 @@ are automatically verified by this action. The sha265 hashes can be found on the
7164

7265
### Enable caching
7366

74-
If you enable caching the [uv cache](https://docs.astral.sh/uv/concepts/cache/) will be cached to
75-
the GitHub Actions Cache. This can speed up runs which can reuse the cache by several minutes. The
76-
cache will always be reused on self-hosted runners.
67+
If you enable caching, the [uv cache](https://docs.astral.sh/uv/concepts/cache/) will be cached to
68+
the GitHub Actions Cache. This can speed up runs that reuse the cache by several minutes. The cache
69+
will always be reused on self-hosted runners.
7770

7871
You can optionally define a custom cache key suffix.
7972

@@ -86,8 +79,8 @@ You can optionally define a custom cache key suffix.
8679
cache-suffix: "optional-suffix"
8780
```
8881

89-
When the cache was successfully restored the output `cache-hit` will be set to `true` and you can
90-
use it in subsequent steps. For the example above you can use it like this:
82+
When the cache was successfully restored, the output `cache-hit` will be set to `true` and you can
83+
use it in subsequent steps. For example, to use the cache in the above case:
9184

9285
```yaml
9386
- name: Do something if the cache was restored
@@ -97,8 +90,8 @@ use it in subsequent steps. For the example above you can use it like this:
9790

9891
#### Local cache path
9992

100-
If you want to save the cache to a local path other than the default path (`/tmp/setup-uv-cache`)
101-
you can specify the path with the `cache-local-path` input.
93+
If you want to save the cache to a local path other than the default path (`/tmp/setup-uv-cache`),
94+
specify the path with the `cache-local-path` input.
10295

10396
```yaml
10497
- name: Define a custom uv cache path
@@ -110,7 +103,7 @@ you can specify the path with the `cache-local-path` input.
110103

111104
#### Cache dependency glob
112105

113-
If you want to control when the cache is invalidated you can specify a glob pattern with the
106+
If you want to control when the cache is invalidated, specify a glob pattern with the
114107
`cache-dependency-glob` input. The cache will be invalidated if any file matching the glob pattern
115108
changes. The glob matches files relative to the repository root.
116109

@@ -132,8 +125,8 @@ changes. The glob matches files relative to the repository root.
132125

133126
### API rate limit
134127

135-
To avoid hitting the error `API rate limit exceeded` you can supply a GitHub token with the
136-
`github-token` input.
128+
To avoid hitting the error `API rate limit exceeded`, supply a GitHub token with the `github-token`
129+
input.
137130

138131
```yaml
139132
- name: Install uv and supply a GitHub token
@@ -144,20 +137,21 @@ To avoid hitting the error `API rate limit exceeded` you can supply a GitHub tok
144137

145138
## How it works
146139

147-
This action downloads uv from the releases of the [uv repo](https://github.com/astral-sh/uv) and
148-
uses the [GitHub Actions Toolkit](https://github.com/actions/toolkit) to cache it as a tool to speed
149-
up consecutive runs on self-hosted runners.
140+
This action downloads uv from the uv repo's official
141+
[GitHub Releases](https://github.com/astral-sh/uv) and uses the
142+
[GitHub Actions Toolkit](https://github.com/actions/toolkit) to cache it as a tool to speed up
143+
consecutive runs on self-hosted runners.
150144

151-
The installed version of uv is then added to the runner path so other steps can just use it by
152-
calling `uv`.
145+
The installed version of uv is then added to the runner PATH, enabling subsequent steps to invoke it
146+
by name (`uv`).
153147

154148
## FAQ
155149

156150
### Do I still need actions/setup-python when using this action?
157151

158152
No! This action was modelled as a drop-in replacement for `actions/setup-python` when using uv.
159153

160-
A simple example workflow could look like this:
154+
For example:
161155

162156
```yaml
163157
- name: Checkout the repository
@@ -170,7 +164,7 @@ A simple example workflow could look like this:
170164
run: uv run --frozen pytest
171165
```
172166

173-
If you want to have a specific python version installed you can use the command
167+
To install a specific version of Python, use
174168
[`uv python install`](https://docs.astral.sh/uv/guides/install-python/):
175169

176170
```yaml
@@ -184,12 +178,10 @@ If you want to have a specific python version installed you can use the command
184178

185179
### What is the default version?
186180

187-
By default, this action installs the version defined as `default` in `action.yml`. When a new
188-
release of uv is published this triggers an automatic release of this action with the new version as
189-
`default`.
181+
By default, this action installs the latest version of uv.
190182

191-
If you have to know the version installed for other steps of your workflow you can use the
192-
`uv-version` output:
183+
If you require the installed version in subsequent steps of your workflow, use the `uv-version`
184+
output:
193185

194186
```yaml
195187
- name: Checkout the repository

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: "eifinger"
44
inputs:
55
version:
66
description: "The version of uv to install"
7-
default: "0.4.4"
7+
default: "latest"
88
checksum:
99
description: "The checksum of the uv version to install"
1010
required: false

0 commit comments

Comments
 (0)