Skip to content

Commit 8b162a5

Browse files
authored
chore: improve readme (#74)
1 parent f1ac2c8 commit 8b162a5

File tree

2 files changed

+52
-8
lines changed

2 files changed

+52
-8
lines changed

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,22 @@ Targets the latest major, minor and patch version of Deno.
5454
deno-version: e7b7129b7a92b7500ded88f8f5baa25a7f59e56e
5555
```
5656
57-
### Release candidate
57+
### Latest release candidate
5858
5959
```yaml
6060
- uses: denoland/setup-deno@v1
6161
with:
6262
deno-version: rc
6363
```
6464
65+
### Specific release candidate
66+
67+
```yaml
68+
- uses: denoland/setup-deno@v1
69+
with:
70+
deno-version: 2.0.0-rc.1
71+
```
72+
6573
### Version from file
6674
6775
The extension can also automatically read the version file from
@@ -84,8 +92,44 @@ The extension can also automatically read the file from
8492

8593
### Specifying binary name
8694

95+
This is useful when you want to install different versions of Deno side by side.
96+
8797
```yaml
8898
- uses: denoland/setup-deno@v1
8999
with:
90-
deno-binary-name: deno_latest
100+
deno-version: canary
101+
deno-binary-name: deno_canary
102+
```
103+
104+
### Determining the release channel
105+
106+
You can determine the release channel reading back the `release-channel` output.
107+
108+
Valid values are `stable`, `canary` and `rc`.
109+
110+
```yaml
111+
- uses: denoland/setup-deno@v1
112+
id: deno
113+
with:
114+
deno-version: canary
115+
116+
- run: echo "Deno release channel is ${{ steps.deno.outputs.release-channel }}"
117+
```
118+
119+
### Determining the installed version
120+
121+
You can determine the installed version reading back the `deno-version` output.
122+
123+
For canary versions, the output will be in the form `0.0.0-GIT_HASH`.
124+
125+
For stable and rc versions, the output will be the regular semver version
126+
number.
127+
128+
```yaml
129+
- uses: denoland/setup-deno@v1
130+
id: deno
131+
with:
132+
deno-version: canary
133+
134+
- run: echo "Deno version is ${{ steps.deno.outputs.deno-version }}"
91135
```

src/version.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ const GIT_HASH_RE = /^[0-9a-fA-F]{40}$/;
77
/**
88
* @typedef VersionRange
99
* @property {string} range
10-
* @property {"canary" | "rc" | "release"} kind
10+
* @property {"canary" | "rc" | "stable"} kind
1111
*/
1212

1313
/**
1414
* @typedef Version
1515
* @property {string} version
16-
* @property {"canary" | "rc" | "release"} kind
16+
* @property {"canary" | "rc" | "stable"} kind
1717
*/
1818

1919
/**
@@ -35,7 +35,7 @@ export function parseVersionRange(version) {
3535
}
3636

3737
if (version === "latest") {
38-
return { range: "latest", kind: "release" };
38+
return { range: "latest", kind: "stable" };
3939
}
4040

4141
if (GIT_HASH_RE.test(version)) {
@@ -44,7 +44,7 @@ export function parseVersionRange(version) {
4444

4545
const range = semver.validRange(version);
4646
if (range !== null) {
47-
return { range, kind: "release" };
47+
return { range, kind: "stable" };
4848
}
4949

5050
return null;
@@ -154,7 +154,7 @@ async function resolveRelease(range) {
154154
if (version === null) {
155155
throw new Error("Failed to parse release version.");
156156
}
157-
return { version, kind: "release" };
157+
return { version, kind: "stable" };
158158
} else {
159159
const res = await fetchWithRetries("https://deno.com/versions.json");
160160
if (res.status !== 200) {
@@ -182,7 +182,7 @@ async function resolveRelease(range) {
182182
version = semver.clean(version);
183183
if (version === null) throw new Error("UNREACHABLE");
184184

185-
return { version, kind: "release" };
185+
return { version, kind: version.includes("-rc.") ? "rc" : "stable" };
186186
}
187187
}
188188

0 commit comments

Comments
 (0)