Skip to content

Commit 32c5b0e

Browse files
committed
Just put the helper functions in the same class to avoid typescript woes
1 parent 1022f67 commit 32c5b0e

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

setup-binary.ts

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import * as core from "@actions/core";
22
import * as hc from "@hashicorp/js-releases";
33
import * as io from "@actions/io";
44
import * as cache from "@actions/tool-cache";
5-
import {getPlatform, getArch} from "./system";
65
import * as semver from "semver";
6+
import os from "os";
77
import cp from "child_process";
88
import path from "path";
99
import { ok } from "assert";
@@ -90,3 +90,38 @@ function getTempDir(): string {
9090
ok(tmpDir, "Expected RUNNER_TEMP to be defined");
9191
return tmpDir;
9292
}
93+
94+
95+
function getPlatform(): string {
96+
const platform = os.platform();
97+
switch (platform) {
98+
case "darwin":
99+
return "darwin";
100+
case "freebsd":
101+
return "freebsd";
102+
case "linux":
103+
return "linux";
104+
case "openbsd":
105+
return "openbsd";
106+
case "win32":
107+
return "windows";
108+
default:
109+
throw new Error(`Unsupported operating system platform: ${platform}`);
110+
}
111+
}
112+
113+
function getArch(): string {
114+
const arch = os.arch();
115+
switch (arch) {
116+
case "arm":
117+
return "arm";
118+
case "arm64":
119+
return "arm64";
120+
case "x32":
121+
return "386";
122+
case "x64":
123+
return "amd64";
124+
default:
125+
throw new Error(`Unsupported operating system architecture: ${arch}`);
126+
}
127+
}

system.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)