mirror of
https://github.com/easingthemes/ssh-deploy.git
synced 2025-06-21 12:02:09 +10:00
feat: Add multi source and multi target support
This commit is contained in:
parent
98ee38d52e
commit
73a65ec97c
9 changed files with 227 additions and 70 deletions
|
@ -10,12 +10,12 @@ const githubWorkspace = process.env.GITHUB_WORKSPACE;
|
|||
const remoteUser = process.env.REMOTE_USER;
|
||||
|
||||
const defaultInputs = {
|
||||
source: '',
|
||||
source: './',
|
||||
target: `/home/${remoteUser}/`,
|
||||
exclude: '',
|
||||
args: '-rltgoDzvO',
|
||||
sshCmdArgs: '-o StrictHostKeyChecking=no',
|
||||
deployKeyName: 'deploy_key'
|
||||
deployKeyName: `deploy_key_${remoteUser}_${Date.now()}`
|
||||
};
|
||||
|
||||
const inputs = {
|
||||
|
@ -29,6 +29,9 @@ inputNames.forEach((input) => {
|
|||
let extendedVal = validVal;
|
||||
// eslint-disable-next-line default-case
|
||||
switch (inputName) {
|
||||
case 'source':
|
||||
extendedVal = validVal.indexOf(' ') > -1 ? validVal.split(' ') : validVal;
|
||||
break;
|
||||
case 'args':
|
||||
extendedVal = validVal.split(' ');
|
||||
break;
|
||||
|
|
|
@ -17,7 +17,7 @@ const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Prom
|
|||
writeToFile({ dir: githubWorkspace, filename, content });
|
||||
console.log(`Executing remote script: ssh -i ${privateKeyPath} ${sshServer}`);
|
||||
exec(
|
||||
`DEBIAN_FRONTEND=noninteractive ssh -i ${privateKeyPath} ${sshServer} 'RSYNC_STDOUT="${process.env.RSYNC_STDOUT}" bash -s' < ${filename}`,
|
||||
`DEBIAN_FRONTEND=noninteractive ssh -i ${privateKeyPath} -o StrictHostKeyChecking=no ${sshServer} 'RSYNC_STDOUT="${process.env.RSYNC_STDOUT}" bash -s' < ${filename}`,
|
||||
(err, data, stderr) => {
|
||||
if (err) {
|
||||
const message = `⚠️ [CMD] Remote script failed: ${err.message}`;
|
||||
|
|
|
@ -55,7 +55,7 @@ const rsyncCli = async ({
|
|||
privateKeyPath, args, sshCmdArgs
|
||||
}) => {
|
||||
console.log(`[Rsync] Starting Rsync Action: ${source} to ${rsyncServer}`);
|
||||
if (exclude) console.log(`[Rsync] excluding folders ${exclude}`);
|
||||
if (exclude && exclude.length > 0) console.log(`[Rsync] excluding folders ${exclude}`);
|
||||
|
||||
const defaultOptions = {
|
||||
ssh: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue