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

feat: allow specifying binary name #71

Merged
merged 10 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,16 @@ jobs:

- name: Check version
run: deno -V | grep -q "deno 1\.43\.1"

test-binary-name:
runs-on: ubuntu-latest
crowlKats marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v3

- name: Setup Deno
uses: ./
with:
deno-binary-name: deno_foo

- name: Check binary exists
run: deno_foo -V
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ inputs:
default: "1.x"
deno-version-file:
description: File containing the Deno version to install such as .dvmrc or .tool-versions.
deno-binary-name:
description: The name to use for the binary.
default: "deno"
outputs:
deno-version:
description: "The Deno version that was installed."
Expand Down
11 changes: 10 additions & 1 deletion src/install.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const os = require("os");
const path = require("path");
const fs = require("fs/promises");
const process = require("process");
const core = require("@actions/core");
const tc = require("@actions/tool-cache");
Expand Down Expand Up @@ -28,9 +29,17 @@ async function install(version) {
const zipPath = await tc.downloadTool(url);
const extractedFolder = await tc.extractZip(zipPath);

const binaryName = core.getInput("deno-binary-name");
if (binaryName !== "deno") {
await fs.rename(
path.join(extractedFolder, "deno"),
crowlKats marked this conversation as resolved.
Show resolved Hide resolved
path.join(extractedFolder, binaryName),
);
}

const newCachedPath = await tc.cacheDir(
extractedFolder,
"deno",
binaryName,
version.isCanary ? `0.0.0-${version.version}` : version.version,
);
core.info(`Cached Deno to ${newCachedPath}.`);
Expand Down
Loading