Skip to content

Commit

Permalink
chore: First implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Jefferson <jefferson.rios.caro@gmail.com>
  • Loading branch information
riosje committed Feb 26, 2024
1 parent a7e048f commit e181e1c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
17 changes: 10 additions & 7 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32758,24 +32758,27 @@ async function setupNsolid({ nodeVersion, nsolidVersion, platform, arch }) {
arch,
});
let toolPath = await downloadNsolid(metadata);
if (core.platform.isWindows) {
toolPath = external_path_.join(core.core.toWin32Path(toolPath));
}
if (!core.platform.isWindows) {
if (metadata.platform !== "win32") {
toolPath = external_path_.join(toolPath, "bin");
}
core.core.info(`N|Solid has been added to the path at ${toolPath}`);

core.core.addPath(toolPath);
if (metadata.platform == "win32") {
toolPath = external_path_.join(core.toWin32Path(toolPath));
}
core.addPath(toolPath);
return;
}

async function downloadNsolid(metadata) {
let downloadPath = "";
const fileName = `nsolid-v${metadata.nsolidVersion}-${metadata.nodeVersion}-${metadata.platform}-${metadata.arch}`;
downloadPath = await tool_cache.downloadTool(metadata.url, `${fileName}.tar.gz`);
const toolPath = await tool_cache.extractTar(downloadPath, fileName, ["xz", "--strip", "1"]);
if (metadata.platform === "win32") {
const toolPath = await tool_cache.extractTar(downloadPath, fileName, ["xz", "--strip", "4"])
return toolPath;
}

const toolPath = await tool_cache.extractTar(downloadPath, fileName, ["xz", "--strip", "1"]);
return toolPath;
}

Expand Down
17 changes: 10 additions & 7 deletions src/lib/install.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { core, platform as os} from "@actions/core";
import core from "@actions/core";
import * as tc from "@actions/tool-cache";
import { getNsolidVersion } from "./metadata.js";
import * as path from "path";
Expand All @@ -11,14 +11,13 @@ export async function setupNsolid({ nodeVersion, nsolidVersion, platform, arch }
arch,
});
let toolPath = await downloadNsolid(metadata);
if (os.isWindows) {
toolPath = path.join(core.toWin32Path(toolPath));
}
if (!os.isWindows) {
if (metadata.platform !== "win32") {
toolPath = path.join(toolPath, "bin");
}
core.info(`N|Solid has been added to the path at ${toolPath}`);

if (metadata.platform == "win32") {
toolPath = path.join(core.toWin32Path(toolPath));
}
core.addPath(toolPath);
return;
}
Expand All @@ -27,7 +26,11 @@ async function downloadNsolid(metadata) {
let downloadPath = "";
const fileName = `nsolid-v${metadata.nsolidVersion}-${metadata.nodeVersion}-${metadata.platform}-${metadata.arch}`;
downloadPath = await tc.downloadTool(metadata.url, `${fileName}.tar.gz`);
const toolPath = await tc.extractTar(downloadPath, fileName, ["xz", "--strip", "1"]);
if (metadata.platform === "win32") {
const toolPath = await tc.extractTar(downloadPath, fileName, ["xz", "--strip", "4"])
return toolPath;
}

const toolPath = await tc.extractTar(downloadPath, fileName, ["xz", "--strip", "1"]);
return toolPath;
}

0 comments on commit e181e1c

Please sign in to comment.