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

33 lines
1.5 KiB
TypeScript
Raw Permalink 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")),
2021-10-13 01:18:45 -05:00
"exclude": optionalStringArray("exclude", core.getMultilineInput("exclude")),
2020-11-23 01:22:34 -06:00
"log-level": optionalLogLevel("log-level", core.getInput("log-level")),
2022-04-19 14:36:22 +02:00
"security": optionalSecurity("security", core.getInput("security")),
"timeout": optionalInt("timeout", core.getInput("timeout"))
2020-11-23 01:22:34 -06:00
};
2020-08-26 01:28:40 -05:00
await deploy(args);
2020-03-30 23:20:38 -05:00
}
2021-10-13 01:18:45 -05:00
catch (error: any) {
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();