Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve readme #74

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,22 @@ Targets the latest major, minor and patch version of Deno.
deno-version: e7b7129b7a92b7500ded88f8f5baa25a7f59e56e
```

### Release candidate
### Latest release candidate

```yaml
- uses: denoland/setup-deno@v1
with:
deno-version: rc
```

### Specific release candidate

```yaml
- uses: denoland/setup-deno@v1
with:
deno-version: 2.0.0-rc.1
```

### Version from file

The extension can also automatically read the version file from
Expand All @@ -84,8 +92,44 @@ The extension can also automatically read the file from

### Specifying binary name

This is useful when you want to install different versions of Deno side by side.

```yaml
- uses: denoland/setup-deno@v1
with:
deno-binary-name: deno_latest
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
- uses: denoland/setup-deno@v1
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
- uses: denoland/setup-deno@v1
id: deno
with:
deno-version: canary

- run: echo "Deno version is ${{ steps.deno.outputs.deno-version }}"
```
12 changes: 6 additions & 6 deletions src/version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const GIT_HASH_RE = /^[0-9a-fA-F]{40}$/;
/**
* @typedef VersionRange
* @property {string} range
* @property {"canary" | "rc" | "release"} kind
* @property {"canary" | "rc" | "stable"} kind
*/

/**
* @typedef Version
* @property {string} version
* @property {"canary" | "rc" | "release"} kind
* @property {"canary" | "rc" | "stable"} kind
*/

/**
Expand All @@ -35,7 +35,7 @@ export function parseVersionRange(version) {
}

if (version === "latest") {
return { range: "latest", kind: "release" };
return { range: "latest", kind: "stable" };
}

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

const range = semver.validRange(version);
if (range !== null) {
return { range, kind: "release" };
return { range, kind: "stable" };
}

return null;
Expand Down Expand Up @@ -154,7 +154,7 @@ async function resolveRelease(range) {
if (version === null) {
throw new Error("Failed to parse release version.");
}
return { version, kind: "release" };
return { version, kind: "stable" };
} else {
const res = await fetchWithRetries("https://deno.com/versions.json");
if (res.status !== 200) {
Expand Down Expand Up @@ -182,7 +182,7 @@ async function resolveRelease(range) {
version = semver.clean(version);
if (version === null) throw new Error("UNREACHABLE");

return { version, kind: "release" };
return { version, kind: version.includes("-rc.") ? "rc" : "stable" };
}
}

Expand Down
Loading