mirror of
https://github.com/easingthemes/ssh-deploy.git
synced 2024-11-19 08:08:05 +08:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a73c81ee7b | ||
|
91b6d280ae | ||
|
4f233a7f45 | ||
|
47f78aa96e | ||
|
8e19e0d6bc | ||
|
da62405174 | ||
|
2a85c96230 | ||
|
ac90bba983 | ||
|
05ddb64347 | ||
|
8f715957ab | ||
|
1b29e52589 | ||
|
18abe921d8 | ||
|
85f4a96743 | ||
|
c59d8e4eeb | ||
|
5c0c73092e | ||
|
51a00631e2 | ||
|
4a7a6fbdf2 | ||
|
fe4bee416c | ||
|
18600dc04b | ||
|
2cd8a820e2 |
37
.github/workflows/e2e.yml
vendored
37
.github/workflows/e2e.yml
vendored
@@ -3,6 +3,21 @@ name: e2e Test
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ 'main' ]
|
branches: [ 'main' ]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
ARGS:
|
||||||
|
description: 'ARGS'
|
||||||
|
required: true
|
||||||
|
default: '-rltgoDzvO --delete --chmod=ugo=rwX --progress'
|
||||||
|
EXCLUDE:
|
||||||
|
description: 'EXCLUDE'
|
||||||
|
required: true
|
||||||
|
default: 'skip_dir/, /node_modules/'
|
||||||
|
SSH_CMD_ARGS:
|
||||||
|
description: 'SSH_CMD_ARGS'
|
||||||
|
required: true
|
||||||
|
default: '-o StrictHostKeyChecking=no, -o UserKnownHostsFile=/dev/null'
|
||||||
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TEST_HOST_DOCKER: ./test
|
TEST_HOST_DOCKER: ./test
|
||||||
@@ -48,26 +63,34 @@ jobs:
|
|||||||
|
|
||||||
- name: Create project file
|
- name: Create project file
|
||||||
run: |
|
run: |
|
||||||
mkdir test_project
|
mkdir test_project && cd "$_"
|
||||||
cd test_project
|
|
||||||
touch index.html
|
touch index.html
|
||||||
date +"%Y-%m-%d %H:%M:%S,%3N" >> index.html
|
date +"%Y-%m-%d %H:%M:%S,%3N" >> index.html
|
||||||
|
truncate -s 50MB image.svg
|
||||||
|
truncate -s 5MB info.txt
|
||||||
|
truncate -s 500MB big_file.txt
|
||||||
|
mkdir skip_dir && cd "$_"
|
||||||
|
truncate -s 5MB text_in_skip_dir.txt
|
||||||
|
cd ../
|
||||||
cat index.html
|
cat index.html
|
||||||
|
echo "test_project: \n" && ls -l
|
||||||
|
echo "skip_dir: \n" && ls -l skip_dir
|
||||||
|
|
||||||
- name: e2e Test published ssh-deploy action
|
- name: e2e Test published ssh-deploy action
|
||||||
uses: easingthemes/ssh-deploy@main
|
uses: easingthemes/ssh-deploy@main
|
||||||
env:
|
env:
|
||||||
|
# ENV Vars created in previous steps:
|
||||||
# SSH_PRIVATE_KEY: $EXAMPLE_SSH_PRIVATE_KEY
|
# SSH_PRIVATE_KEY: $EXAMPLE_SSH_PRIVATE_KEY
|
||||||
# REMOTE_HOST: $EXAMPLE_REMOTE_HOST
|
# REMOTE_HOST: $EXAMPLE_REMOTE_HOST
|
||||||
REMOTE_USER: ${{ env.TEST_USER }}
|
REMOTE_USER: ${{ env.TEST_USER }}
|
||||||
ARGS: "-rltgoDzvO"
|
ARGS: ${{ github.event.inputs.ARGS || '-rltgoDzvO --delete --chmod=ugo=rwX --progress' }}
|
||||||
|
SSH_CMD_ARGS: ${{ github.event.inputs.SSH_CMD_ARGS || '-o StrictHostKeyChecking=no, -o UserKnownHostsFile=/dev/null' }}
|
||||||
SOURCE: "test_project/"
|
SOURCE: "test_project/"
|
||||||
TARGET: "/var/www/html/"
|
TARGET: "/var/www/html/"
|
||||||
EXCLUDE: "/dist/, /node_modules/"
|
EXCLUDE: ${{ github.event.inputs.EXCLUDE || 'skip_dir/, /node_modules/' }}
|
||||||
SCRIPT_BEFORE: |
|
SCRIPT_BEFORE: |
|
||||||
whoami
|
whoami
|
||||||
ls -al
|
ls -al /var/www/html/
|
||||||
SCRIPT_AFTER: |
|
SCRIPT_AFTER: |
|
||||||
whoami
|
ls -al /var/www/html/
|
||||||
ls -al
|
|
||||||
echo $RSYNC_STDOUT
|
echo $RSYNC_STDOUT
|
||||||
|
@@ -67,6 +67,11 @@ Execution is preformed by storing commands in `.sh` file and executing it via `.
|
|||||||
Script to run on host machine after rsync.
|
Script to run on host machine after rsync.
|
||||||
Rsync output is stored in `$RSYNC_STDOUT` env variable.
|
Rsync output is stored in `$RSYNC_STDOUT` env variable.
|
||||||
|
|
||||||
|
##### 11. `SSH_CMD_ARGS` (optional, default '-o StrictHostKeyChecking=no')
|
||||||
|
|
||||||
|
A list of ssh arguments, they must be prefixed with -o and separated by a comma, for example: -o SomeArgument=no, -o SomeOtherArgument=5
|
||||||
|
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Use the latest version from Marketplace,eg: ssh-deploy@v2
|
Use the latest version from Marketplace,eg: ssh-deploy@v2
|
||||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,3 +1,60 @@
|
|||||||
|
## [3.3.4](https://github.com/easingthemes/ssh-deploy/compare/v3.3.3...v3.3.4) (2023-01-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Add visible Rsync CMD for debugging ([91b6d28](https://github.com/easingthemes/ssh-deploy/commit/91b6d280aee6a7ae666a11426fb356406f4a25a5))
|
||||||
|
|
||||||
|
## [3.3.3](https://github.com/easingthemes/ssh-deploy/compare/v3.3.2...v3.3.3) (2023-01-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* log buffer from rsync stdout ([8e19e0d](https://github.com/easingthemes/ssh-deploy/commit/8e19e0d6bc9b1c332925ce0268ad64b50728fae5))
|
||||||
|
|
||||||
|
## [3.3.2](https://github.com/easingthemes/ssh-deploy/compare/v3.3.1...v3.3.2) (2023-01-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Add manual inputs for e2e test ([8f71595](https://github.com/easingthemes/ssh-deploy/commit/8f715957ab9283ab2934dd1e5be9d78f2eaf3fae))
|
||||||
|
|
||||||
|
## [3.3.1](https://github.com/easingthemes/ssh-deploy/compare/v3.3.0...v3.3.1) (2023-01-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Log rsync command ([85f4a96](https://github.com/easingthemes/ssh-deploy/commit/85f4a967435d7d44edf2fea628c9f59db5e890ee))
|
||||||
|
|
||||||
|
# [3.3.0](https://github.com/easingthemes/ssh-deploy/compare/v3.2.0...v3.3.0) (2023-01-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add SSH_CMD_ARGS support ([51a0063](https://github.com/easingthemes/ssh-deploy/commit/51a00631e2b91983fb610ca2157a673b9ae03c95))
|
||||||
|
|
||||||
|
# [3.2.0](https://github.com/easingthemes/ssh-deploy/pull/94/files) (2023-01-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add SSH remote script support - before and after rsync ([2cd8a82](https://github.com/easingthemes/ssh-deploy/pull/94/files))
|
||||||
|
* feat: add sshCmdArgs option
|
||||||
|
* feat: add onStderr and onStdout logs
|
||||||
|
* feat: Add RSYNC_STDOUT env variable
|
||||||
|
* feat: Update emojis
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix: remove _unsafe _dirname
|
||||||
|
* fix: Add promise instead of callback
|
||||||
|
* fix: improve logs
|
||||||
|
* fix: Add simple command exists instead of a plugin
|
||||||
|
* fix: add non interactive install
|
||||||
|
* fix: Improve reject messages
|
||||||
|
* fix: update workflow actions
|
||||||
|
|
||||||
|
|
||||||
## [3.1.1](https://github.com/easingthemes/ssh-deploy/compare/v3.1.0...v3.1.1) (2023-01-02)
|
## [3.1.1](https://github.com/easingthemes/ssh-deploy/compare/v3.1.0...v3.1.1) (2023-01-02)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@draganfilipovic/ssh-deploy",
|
"name": "@draganfilipovic/ssh-deploy",
|
||||||
"version": "3.1.1",
|
"version": "3.3.4",
|
||||||
"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": [
|
||||||
|
@@ -2,6 +2,12 @@ const { execSync } = require('child_process');
|
|||||||
const nodeRsync = require('rsyncwrapper');
|
const nodeRsync = require('rsyncwrapper');
|
||||||
|
|
||||||
const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => {
|
const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => {
|
||||||
|
const logCMD = (cmd) => {
|
||||||
|
console.warn('================================================================');
|
||||||
|
console.log(cmd);
|
||||||
|
console.warn('================================================================');
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
nodeRsync(config, (error, stdout, stderr, cmd) => {
|
nodeRsync(config, (error, stdout, stderr, cmd) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -11,9 +17,12 @@ const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => {
|
|||||||
console.error(stderr);
|
console.error(stderr);
|
||||||
console.error('❌️ [Rsync] stdout: ');
|
console.error('❌️ [Rsync] stdout: ');
|
||||||
console.error(stdout);
|
console.error(stdout);
|
||||||
console.error('❌ [Rsync] cmd: ', cmd);
|
console.error('❌ [Rsync] command: ');
|
||||||
|
logCMD(cmd);
|
||||||
reject(new Error(`${error.message}\n\n${stderr}`));
|
reject(new Error(`${error.message}\n\n${stderr}`));
|
||||||
} else {
|
} else {
|
||||||
|
console.log('⭐ [Rsync] command finished: ');
|
||||||
|
logCMD(cmd);
|
||||||
resolve(stdout);
|
resolve(stdout);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -50,7 +59,9 @@ const rsyncCli = async ({
|
|||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
ssh: true,
|
ssh: true,
|
||||||
recursive: true
|
recursive: true,
|
||||||
|
onStdout: (data) => console.log(data.toString()),
|
||||||
|
onStderr: (data) => console.error(data.toString())
|
||||||
};
|
};
|
||||||
|
|
||||||
// RSYNC COMMAND
|
// RSYNC COMMAND
|
||||||
@@ -58,8 +69,7 @@ const rsyncCli = async ({
|
|||||||
return nodeRsyncPromise({
|
return nodeRsyncPromise({
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
src: source, dest: rsyncServer, excludeFirst: exclude, port: remotePort,
|
src: source, dest: rsyncServer, excludeFirst: exclude, port: remotePort,
|
||||||
privateKey: privateKeyPath, args, sshCmdArgs,
|
privateKey: privateKeyPath, args, sshCmdArgs
|
||||||
onStdout: (data) => console.log(data), onStderr: (data) => console.error(data)
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user