mirror of
https://github.com/easingthemes/ssh-deploy.git
synced 2024-11-14 07:08:04 +00:00
fix: fix default TARGET
This commit is contained in:
parent
056fb0fea7
commit
4d086346af
@ -22,7 +22,7 @@ inputs:
|
|||||||
TARGET:
|
TARGET:
|
||||||
description: "Target directory"
|
description: "Target directory"
|
||||||
required: false
|
required: false
|
||||||
default: "/home/REMOTE_USER/"
|
default: ""
|
||||||
ARGS:
|
ARGS:
|
||||||
description: "Arguments to pass to rsync"
|
description: "Arguments to pass to rsync"
|
||||||
required: false
|
required: false
|
||||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -10,36 +10,29 @@ const githubWorkspace = process.env.GITHUB_WORKSPACE;
|
|||||||
const remoteUser = process.env.REMOTE_USER || process.env.INPUT_REMOTE_USER;
|
const remoteUser = process.env.REMOTE_USER || process.env.INPUT_REMOTE_USER;
|
||||||
|
|
||||||
const defaultInputs = {
|
const defaultInputs = {
|
||||||
source: '',
|
|
||||||
target: `/home/${remoteUser}/`,
|
target: `/home/${remoteUser}/`,
|
||||||
exclude: '',
|
|
||||||
args: '-rlgoDzvc -i',
|
|
||||||
sshCmdArgs: '-o StrictHostKeyChecking=no',
|
|
||||||
deployKeyName: `deploy_key_${remoteUser}_${Date.now()}`
|
deployKeyName: `deploy_key_${remoteUser}_${Date.now()}`
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('[DEFAULTS] default inputs', defaultInputs);
|
|
||||||
|
|
||||||
const inputs = {
|
const inputs = {
|
||||||
githubWorkspace
|
githubWorkspace
|
||||||
};
|
};
|
||||||
|
|
||||||
inputNames.forEach((input) => {
|
inputNames.forEach((input) => {
|
||||||
const inputName = snakeToCamel(input.toLowerCase());
|
const inputName = snakeToCamel(input.toLowerCase());
|
||||||
const inputVal = process.env[input] || process.env[`INPUT_${input}`];
|
const inputVal = process.env[input] || process.env[`INPUT_${input}`] || defaultInputs[inputName];
|
||||||
const validVal = inputVal === undefined ? defaultInputs[inputName] : inputVal;
|
let extendedVal = inputVal;
|
||||||
let extendedVal = validVal;
|
|
||||||
// eslint-disable-next-line default-case
|
// eslint-disable-next-line default-case
|
||||||
switch (inputName) {
|
switch (inputName) {
|
||||||
case 'source':
|
case 'source':
|
||||||
extendedVal = validVal.split(' ').map((src) => `${githubWorkspace}/${src}`);
|
extendedVal = inputVal.split(' ').map((src) => `${githubWorkspace}/${src}`);
|
||||||
break;
|
break;
|
||||||
case 'args':
|
case 'args':
|
||||||
extendedVal = validVal.split(' ');
|
extendedVal = inputVal.split(' ');
|
||||||
break;
|
break;
|
||||||
case 'exclude':
|
case 'exclude':
|
||||||
case 'sshCmdArgs':
|
case 'sshCmdArgs':
|
||||||
extendedVal = validVal.split(',').map((item) => item.trim());
|
extendedVal = inputVal.split(',').map((item) => item.trim());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ const addSshKey = (content, deployKeyName) => {
|
|||||||
const { dir, filename } = getPrivateKeyPath(deployKeyName);
|
const { dir, filename } = getPrivateKeyPath(deployKeyName);
|
||||||
writeToFile({ dir, filename: KNOWN_HOSTS, content: '' });
|
writeToFile({ dir, filename: KNOWN_HOSTS, content: '' });
|
||||||
console.log('✅ [SSH] known_hosts file ensured', dir);
|
console.log('✅ [SSH] known_hosts file ensured', dir);
|
||||||
writeToFile({ dir, filename, content, isRequired: true, mode: '0400' });
|
writeToFile({ dir, filename, content: `${content}\r\n`, isRequired: true, mode: '0400' });
|
||||||
console.log('✅ [SSH] key added to `.ssh` dir ', dir, filename);
|
console.log('✅ [SSH] key added to `.ssh` dir ', dir, filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user