-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
42 lines (40 loc) · 1.07 KB
/
index.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
42
import { getInput, setOutput, setFailed } from '@actions/core'
import uploadCommand from './src/commands/uploadCommand.js'
import infoCommand from './src/commands/infoCommand.js'
import setCommand from './src/commands/setCommand.js'
try {
const command = getInput('command')
const directory = getInput('directory')
const dryRun = getInput('dry-run').toLowerCase() === 'true'
const privateKey = getInput('private-key')
const manifestId = getInput('manifest-id')
const antAddress = getInput('ant-address')
switch (command) {
case 'upload':
await uploadCommand.handler({
directory,
antAddress,
dryRun,
privateKey,
})
break
case 'address':
const address = await infoCommand.handler({
privateKey
})
setOutput('address', address)
break
case 'set':
await setCommand.handler({
antAddress,
manifestId,
privateKey,
dryRun
})
break
default:
throw new Error(`${command} not supported`)
}
} catch (error) {
setFailed(error.message)
}