1
0
Files
setup-deno/README.md
T

182 lines
3.7 KiB
Markdown
Raw Normal View History

2021-04-10 01:39:22 +02:00
# setup-deno
2021-04-10 02:16:12 +02:00
2021-04-10 02:24:16 +02:00
Set up your GitHub Actions workflow with a specific version of Deno.
## Usage
### Latest stable for a major
2021-04-10 02:24:16 +02:00
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2021-04-10 02:24:16 +02:00
with:
2024-10-09 01:54:03 -07:00
deno-version: v2.x
2021-04-10 02:24:16 +02:00
```
### Latest stable for any major
Targets the latest major, minor and patch version of Deno.
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
with:
deno-version: vx.x.x
```
2021-04-10 02:24:16 +02:00
### Specific stable
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2021-04-10 02:24:16 +02:00
with:
deno-version: "1.8.2"
```
### Semver range
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2021-04-10 02:24:16 +02:00
with:
deno-version: "~1.7"
```
### Latest canary
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2021-04-10 02:24:16 +02:00
with:
deno-version: canary
```
### Specific canary
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2021-04-10 02:24:16 +02:00
with:
deno-version: e7b7129b7a92b7500ded88f8f5baa25a7f59e56e
```
2024-09-02 15:46:47 +02:00
2024-09-13 17:32:16 +02:00
### Latest release candidate
2024-09-13 07:41:34 -07:00
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2024-09-13 07:41:34 -07:00
with:
deno-version: rc
```
2024-09-13 17:32:16 +02:00
### Specific release candidate
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2024-09-13 17:32:16 +02:00
with:
deno-version: 2.0.0-rc.1
```
2025-05-12 18:23:36 +02:00
### Latest LTS
```yaml
- uses: denoland/setup-deno@v2
with:
deno-version: lts
```
2024-09-02 15:46:47 +02:00
### Version from file
2024-09-03 10:36:21 +02:00
The extension can also automatically read the version file from
[`.tool-versions`](https://asdf-vm.com/manage/configuration.html#tool-versions)
2024-09-02 15:46:47 +02:00
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2024-09-02 15:46:47 +02:00
with:
deno-version-file: .tool-versions
```
2024-09-03 10:36:21 +02:00
The extension can also automatically read the file from
[`dvm`](https://github.com/justjavac/dvm).
2024-09-02 15:46:47 +02:00
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2024-09-02 15:46:47 +02:00
with:
deno-version-file: .dvmrc
```
2024-09-12 03:46:45 -07:00
### Specifying binary name
2024-09-13 17:32:16 +02:00
This is useful when you want to install different versions of Deno side by side.
2024-09-12 03:46:45 -07:00
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2024-09-12 03:46:45 -07:00
with:
2024-09-13 17:32:16 +02:00
deno-version: canary
deno-binary-name: deno_canary
```
### Determining the release channel
You can determine the release channel reading back the `release-channel` output.
Valid values are `stable`, `canary` and `rc`.
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2024-09-13 17:32:16 +02:00
id: deno
with:
deno-version: canary
- run: echo "Deno release channel is ${{ steps.deno.outputs.release-channel }}"
```
### Determining the installed version
You can determine the installed version reading back the `deno-version` output.
For canary versions, the output will be in the form `0.0.0-GIT_HASH`.
For stable and rc versions, the output will be the regular semver version
number.
```yaml
2024-10-09 01:54:03 -07:00
- uses: denoland/setup-deno@v2
2024-09-13 17:32:16 +02:00
id: deno
with:
deno-version: canary
- run: echo "Deno version is ${{ steps.deno.outputs.deno-version }}"
2024-09-12 03:46:45 -07:00
```
2025-05-12 18:53:44 +02:00
### Caching dependencies downloaded by Deno automatically
Dependencies installed by Deno can be cached automatically between workflow
runs. This helps make your GH action run faster by not repeating caching work
and network requests done by a previous run.
2025-05-12 18:53:44 +02:00
To enable the cache, use `cache: true`.
2025-05-12 18:53:44 +02:00
```yaml
- uses: denoland/setup-deno@v2
with:
cache: true
```
> [!WARNING]
> If an environment variable `DENO_DIR` is set for steps that run/download
> dependencies, then `DENO_DIR` must also be set for the `denoland/setup-deno`
> action, for the caching to work as intended.
By default, the cache is automatically keyed by:
- the github
[job_id](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_id)
- the runner os and architecture
- a hash of the `deno.lock` files in the project
It is possible to customize the default hash
(`${{ hashFiles('**/deno.lock') }}`) used as part of the cache key via the
`cache-hash` input.
```yaml
- uses: denoland/setup-deno@v2
with:
# setting `cache-hash` implies `cache: true` and will replace
# the default cache-hash of `${{ hashFiles('**/deno.lock') }}`
cache-hash: ${{ hashFiles('**/deno.json') }}
```