mirror of
https://github.com/easingthemes/ssh-deploy.git
synced 2024-11-19 08:08:05 +08:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
45cee3db2e | ||
|
59827af83c | ||
|
adb1a2ce99 | ||
|
4d086346af | ||
|
056fb0fea7 | ||
|
d7e6989d58 | ||
|
0fb307eb41 | ||
|
a7b7e1e49d |
6
.github/workflows/e2e.yml
vendored
6
.github/workflows/e2e.yml
vendored
@@ -100,6 +100,12 @@ jobs:
|
|||||||
# Shared ENV Vars created in previous steps
|
# Shared ENV Vars created in previous steps
|
||||||
REMOTE_USER: ${{ env.TEST_USER2 }}
|
REMOTE_USER: ${{ env.TEST_USER2 }}
|
||||||
TARGET: /var/www/html/${{ env.TEST_USER2 }}
|
TARGET: /var/www/html/${{ env.TEST_USER2 }}
|
||||||
|
|
||||||
|
- name: e2e Test ssh-deploy action - Default values
|
||||||
|
uses: easingthemes/ssh-deploy@main
|
||||||
|
env:
|
||||||
|
# Shared ENV Vars created in previous steps
|
||||||
|
REMOTE_USER: ${{ env.TEST_USER }}
|
||||||
e2e-v3:
|
e2e-v3:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
@@ -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
@@ -1,3 +1,17 @@
|
|||||||
|
## [4.1.2](https://github.com/easingthemes/ssh-deploy/compare/v4.1.1...v4.1.2) (2023-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#113](https://github.com/easingthemes/ssh-deploy/issues/113) limit ssh script output ([59827af](https://github.com/easingthemes/ssh-deploy/commit/59827af83c934996efda72f9fbd1fcd0bb9ccaac))
|
||||||
|
|
||||||
|
## [4.1.1](https://github.com/easingthemes/ssh-deploy/compare/v4.1.0...v4.1.1) (2023-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix default TARGET ([4d08634](https://github.com/easingthemes/ssh-deploy/commit/4d086346af62ac5d57fa37ee6bb46f8de8ad48c3))
|
||||||
|
|
||||||
# [4.1.0](https://github.com/easingthemes/ssh-deploy/compare/v4.0.5...v4.1.0) (2023-02-19)
|
# [4.1.0](https://github.com/easingthemes/ssh-deploy/compare/v4.0.5...v4.1.0) (2023-02-19)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@draganfilipovic/ssh-deploy",
|
"name": "@draganfilipovic/ssh-deploy",
|
||||||
"version": "4.1.0",
|
"version": "4.1.2",
|
||||||
"description": "Fast NodeJS action to deploy specific directory from `GITHUB_WORKSPACE` to a server via rsync over ssh.",
|
"description": "Fast NodeJS action to deploy specific directory from `GITHUB_WORKSPACE` to a server via rsync over ssh.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
@@ -7,14 +7,10 @@ const inputNames = [
|
|||||||
'SCRIPT_BEFORE', 'SCRIPT_AFTER'];
|
'SCRIPT_BEFORE', 'SCRIPT_AFTER'];
|
||||||
|
|
||||||
const githubWorkspace = process.env.GITHUB_WORKSPACE;
|
const githubWorkspace = process.env.GITHUB_WORKSPACE;
|
||||||
const remoteUser = process.env.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()}`
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -24,20 +20,19 @@ const inputs = {
|
|||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,8 +24,9 @@ const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Prom
|
|||||||
console.warn(`${message} \n`, data, stderr);
|
console.warn(`${message} \n`, data, stderr);
|
||||||
handleError(message, isRequired, reject);
|
handleError(message, isRequired, reject);
|
||||||
} else {
|
} else {
|
||||||
console.log('✅ [CMD] Remote script executed. \n', data, stderr);
|
const limited = data.substring(0, 10000);
|
||||||
resolve(data);
|
console.log('✅ [CMD] Remote script executed. \n', limited, stderr);
|
||||||
|
resolve(limited);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user