-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (30 loc) · 930 Bytes
/
index.js
File metadata and controls
35 lines (30 loc) · 930 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
const core = require('@actions/core');
const wait = require('./wait');
const exec = require('@actions/exec');
const github = require('@actions/github');
// most @actions toolkit packages have async methods
async function run() {
const context = github.context;
await exec.exec(`echo ${JSON.stringify(context.repo.repo)}`);
await exec.exec(`npm i -g sbxcloud-cli`);
await runDeploy(0 )
}
async function runDeploy( attempts) {
try {
await exec.exec(
`sbxcloud-cli deploy ${core.getInput('path')} ${core.getInput('folder')} ${core.getInput(
'domain'
)} --username=${core.getInput('username')} --password=${core.getInput(
'password'
)} --confirmation`
);
process.exit(0);
}catch (error){
if (core.getInput('attempts') && core.getInput('attempts') !== '' && parseInt(core.getInput('attempts')) > attempts){
await runDeploy(attempts+1)
}else{
core.setFailed(error.message);
}
}
}
run();