1
0
Files
ftp-deploy-action/src/main.ts
T

32 lines
1.4 KiB
TypeScript
Raw Normal View History

2020-08-28 01:11:57 -05:00
import * as core from "@actions/core";
2020-08-26 01:28:40 -05:00
import { deploy } from "@samkirkland/ftp-deploy";
2020-09-07 14:57:56 -05:00
import { IFtpDeployArguments } from "@samkirkland/ftp-deploy/dist/types";
2020-11-23 01:22:34 -06:00
import { optionalInt, optionalProtocol, optionalString, optionalBoolean, optionalStringArray, optionalLogLevel, optionalSecurity } from "./parse";
2020-08-26 01:28:40 -05:00
async function runDeployment() {
2020-03-30 23:20:38 -05:00
try {
2020-11-23 01:22:34 -06:00
const args: IFtpDeployArguments = {
server: core.getInput("server", { required: true }),
username: core.getInput("username", { required: true }),
password: core.getInput("password", { required: true }),
port: optionalInt("port", core.getInput("port")),
protocol: optionalProtocol("protocol", core.getInput("protocol")),
"local-dir": optionalString(core.getInput("local-dir")),
"server-dir": optionalString(core.getInput("server-dir")),
"state-name": optionalString(core.getInput("state-name")),
"dry-run": optionalBoolean("dry-run", core.getInput("dry-run")),
"dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
"exclude": optionalStringArray("exclude", core.getInput("exclude")),
"log-level": optionalLogLevel("log-level", core.getInput("log-level")),
"security": optionalSecurity("security", core.getInput("security"))
};
2020-08-26 01:28:40 -05:00
await deploy(args);
2020-03-30 23:20:38 -05:00
}
catch (error) {
2020-08-26 01:28:40 -05:00
core.setFailed(error);
2020-02-18 00:34:10 -06:00
}
}
2020-08-27 23:43:10 -05:00
runDeployment();