-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtool.ts
More file actions
35 lines (27 loc) · 913 Bytes
/
tool.ts
File metadata and controls
35 lines (27 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { clean } from 'semver'
import { extractTar, extractZip } from '@actions/tool-cache'
export const toolName = 'stackit'
export const githubRepository = 'stackitcloud/stackit-cli'
// renovate: github=stackitcloud/stackit-cli
export const defaultVersion = 'v0.58.0'
export function binaryName(version: string, os: string, arch: string): string {
version = clean(version) || version
return `stackit-cli_${version}_${os}_${arch}.${os === 'windows' ? 'zip' : 'tar.gz'}`
}
export async function extractBinary(
path: string,
version: string,
os: string,
_arch: string
): Promise<string> {
let extractedFolder
if (os === 'windows') {
extractedFolder = await extractZip(path)
} else {
extractedFolder = await extractTar(path)
}
return `${extractedFolder}/${toolName}${os === 'windows' ? '.exe' : ''}`
}
export function getVersionArguments(): string[] {
return ['--version']
}