forked from wangyucode/sftp-upload-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsftp.cjs
More file actions
25 lines (21 loc) · 1.04 KB
/
sftp.cjs
File metadata and controls
25 lines (21 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const core = require('@actions/core');
const { Deployer } = require('./lib/deployer');
const config = {
host: core.getInput('host'), // Required.
port: core.getInput('port'), // Optional, Default to 22.
username: core.getInput('username'), // Required.
password: core.getInput('password'), // Optional.
privateKey: core.getInput('privateKey'), // Optional.
passphrase: core.getInput('passphrase'), // Optional.
agent: core.getInput('agent'), // Optional, path to the ssh-agent socket.
localDir: core.getInput('localDir'), // Required, Absolute or relative to cwd.
remoteDir: core.getInput('remoteDir') // Required, Absolute path only.
};
const options = {
dryRun: JSON.parse(core.getInput('dryRun')), // Enable dry-run mode. Default to true
exclude: core.getInput('exclude').split(','), // exclude patterns (glob)
forceUpload: JSON.parse(core.getInput('forceUpload')) // Force uploading all files, Default to false(upload only newer files).
};
new Deployer(config, options)
.sync()
.then(() => console.log('sftp upload success!'));