forked from anton-yurchenko/git-release
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrapper.js
41 lines (35 loc) · 1.01 KB
/
wrapper.js
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
36
37
38
39
40
41
const core = require('@actions/core')
const os = require('os')
const path = require('path')
const fs = require('fs')
const child = require('child_process')
function execute (file) {
if (fs.existsSync(file)) {
child.execFileSync(
file,
[core.getInput('args')],
{ stdio: 'inherit' }
)
} else {
core.setFailed(`[wrapper] file not found: '${file}'`)
process.exit(1)
}
}
function main () {
if (os.arch() !== 'x64') {
core.setFailed(`[wrapper] runner cpu architecture is not supported: '${os.arch}'`)
process.exit(1)
}
let filename
if (process.platform === 'win32') {
filename = 'git-release-windows-amd64.exe'
} else if (process.platform === 'linux') {
core.warning('Executing this action via wrapper is not recommended on Linux runner!')
filename = 'git-release-linux-amd64'
} else {
core.setFailed(`[wrapper] runner operation system is not supported: '${process.platform}'`)
process.exit(1)
}
execute(path.join(__dirname, 'bin', filename))
}
main()