File tree Expand file tree Collapse file tree 2 files changed +36
-36
lines changed
Expand file tree Collapse file tree 2 files changed +36
-36
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ import * as core from "@actions/core";
22import * as hc from "@hashicorp/js-releases" ;
33import * as io from "@actions/io" ;
44import * as cache from "@actions/tool-cache" ;
5- import { getPlatform , getArch } from "./system" ;
65import * as semver from "semver" ;
6+ import os from "os" ;
77import cp from "child_process" ;
88import path from "path" ;
99import { 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+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments