Compare commits

...

12 Commits

Author SHA1 Message Date
github-actions
79363f2b74 chore(release): 4.0.1 [skip ci]
## [4.0.1](https://github.com/easingthemes/ssh-deploy/compare/v4.0.0...v4.0.1) (2023-01-03)

### Bug Fixes

* fix default source if empty ([9f191f4](9f191f4263))
2023-01-03 20:57:09 +00:00
Dragan Filipović
7c21074882 Merge pull request #99 from easingthemes/bugfix/fix-empty-src
fix: fix default source if empty
2023-01-03 21:56:33 +01:00
Dragan Filipovic
9f191f4263 fix: fix default source if empty 2023-01-03 21:55:45 +01:00
Dragan Filipovic
006cf3021d Add v3 e2e 2023-01-03 19:29:28 +01:00
github-actions
8be4106fce chore(release): 4.0.0 [skip ci]
# [4.0.0](https://github.com/easingthemes/ssh-deploy/compare/v3.4.3...v4.0.0) (2023-01-03)

### Bug Fixes

* rebuild ([2169399](2169399fef))

### Performance Improvements

* update default rsync options ([2be7efb](2be7efb376))

### BREAKING CHANGES

* Default rsync options updated to speed up default deployments.
from `rltgoDzvO` to `-rlgoDzvc -i`
2023-01-03 08:34:27 +00:00
Dragan Filipović
7c9b40539e Merge pull request #96 from easingthemes/feature/default-rsync-options
feat: update default rsync options
2023-01-03 09:33:49 +01:00
Dragan Filipovic
2169399fef fix: rebuild 2023-01-03 09:25:16 +01:00
Dragan Filipovic
2be7efb376 perf: update default rsync options
BREAKING CHANGE: Default rsync options updated to speed up default deployments.
from `rltgoDzvO` to `-rlgoDzvc -i`
2023-01-03 09:21:19 +01:00
Dragan Filipovic
e6e41a57ec Merge branch 'temp3' 2023-01-03 03:39:52 +01:00
github-actions
c8d57ec8b4 chore(release): 3.4.3 [skip ci]
## [3.4.3](https://github.com/easingthemes/ssh-deploy/compare/v3.4.2...v3.4.3) (2023-01-03)

### Bug Fixes

* move e2e tests typo branch name ([6d3554b](6d3554b01e))
2023-01-03 03:38:43 +01:00
github-actions
8bf58fb293 chore(release): 3.4.3 [skip ci]
## [3.4.3](https://github.com/easingthemes/ssh-deploy/compare/v3.4.2...v3.4.3) (2023-01-03)

### Bug Fixes

* move e2e tests typo branch name ([6d3554b](6d3554b01e))
2023-01-03 02:29:31 +00:00
Dragan Filipovic
6d3554b01e fix: move e2e tests typo branch name 2023-01-03 03:28:39 +01:00
8 changed files with 117 additions and 11 deletions

View File

@@ -6,7 +6,7 @@ on:
ARGS: ARGS:
description: 'ARGS' description: 'ARGS'
required: true required: true
default: '-rltgoDzvO --delete --chmod=ugo+rwX --progress' default: '-rlgoDzvc -i --delete --chmod=ugo+rwX --progress'
EXCLUDE: EXCLUDE:
description: 'EXCLUDE' description: 'EXCLUDE'
required: true required: true

View File

@@ -74,7 +74,7 @@ jobs:
- name: set shared ENV variables for multi target deployment - name: set shared ENV variables for multi target deployment
run: | run: |
echo "ARGS=-rltgoDzvOR --delete --chmod=ugo+rwX --progress" >> $GITHUB_ENV echo "ARGS=-rlgoDzvcR -i --delete --chmod=ugo+rwX --progress" >> $GITHUB_ENV
echo "SSH_CMD_ARGS=-o StrictHostKeyChecking=no, -o UserKnownHostsFile=/dev/null" >> $GITHUB_ENV echo "SSH_CMD_ARGS=-o StrictHostKeyChecking=no, -o UserKnownHostsFile=/dev/null" >> $GITHUB_ENV
echo "SOURCE=test_project/ test_project2/" >> $GITHUB_ENV echo "SOURCE=test_project/ test_project2/" >> $GITHUB_ENV
echo "EXCLUDE=skip_dir/, /node_modules/" >> $GITHUB_ENV echo "EXCLUDE=skip_dir/, /node_modules/" >> $GITHUB_ENV
@@ -95,8 +95,79 @@ jobs:
TARGET: /var/www/html/${{ env.TEST_USER }} TARGET: /var/www/html/${{ env.TEST_USER }}
- name: e2e Test ssh-deploy action - Target 2 - name: e2e Test ssh-deploy action - Target 2
uses: easingthemes/ssh-deploy@feature/multi-src uses: easingthemes/ssh-deploy@main
env: env:
# 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 }}
e2e-v3:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# : ---------------------------------------------------------------
# : START E2E Test Specific - steps
# : ----------------------------------------------------------------
- name: E2E Test Specific - Clean up old test files
run: |
docker stop ssh-host-container || true && docker rm ssh-host-container || true
- name: E2E Test Specific - Create ssh keys
run: |
echo $HOME
ls -la $HOME
ssh-keygen -m PEM -t rsa -b 4096 -f "$HOME/.ssh/id_rsa" -N ""
eval `ssh-agent -s`
ssh-add "$HOME/.ssh/id_rsa"
ssh-add -l
echo "SSH_PRIVATE_KEY<<EOF" >> $GITHUB_ENV
cat $HOME/.ssh/id_rsa >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: E2E Test Specific - Build Host Server Image
working-directory: ${{ env.TEST_HOST_DOCKER }}
run: |
docker build \
-t ssh-host-image . \
--build-arg SSH_PUB_KEY="$(cat $HOME/.ssh/id_rsa.pub)"
docker run -d -p 8822:22 --name=ssh-host-container ssh-host-image
docker exec ssh-host-container sh -c "hostname --ip-address" > ip.txt
echo "REMOTE_HOST<<EOF" >> $GITHUB_ENV
cat ip.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
shell: bash
- name: E2E Test Specific - Create project file
run: |
mkdir test_project2 && cd "$_"
truncate -s 5MB info2.txt
cd ../
mkdir test_project && cd "$_"
touch 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
echo "test_project:" && ls -lR
echo "skip_dir:" && ls -lR skip_dir
# ----------------------------------------------------------------
# END E2E Test Specific - steps
# ----------------------------------------------------------------
- name: e2e Test ssh-deploy action - Target 1
uses: easingthemes/ssh-deploy@v3.4.3
env:
# Shared ENV Vars created in previous steps
REMOTE_USER: ${{ env.TEST_USER }}
TARGET: /var/www/html/${{ env.TEST_USER }}
SOURCE: test_project/
EXCLUDE: skip_dir/, /node_modules/
ARGS: -rlgoDzvcO

View File

@@ -41,7 +41,7 @@ eg: myusername
eg: '59184' eg: '59184'
##### 5. `ARGS` (optional, default '-rltgoDzvO') ##### 5. `ARGS` (optional, default '-rlgoDzvc -i')
For any initial/required rsync flags, eg: `-avzr --delete` For any initial/required rsync flags, eg: `-avzr --delete`
@@ -62,6 +62,8 @@ path to exclude separated by `,`, ie: `/dist/, /node_modules/`
Script to run on host machine before rsync. Single line or multiline commands. Script to run on host machine before rsync. Single line or multiline commands.
Execution is preformed by storing commands in `.sh` file and executing it via `.bash` over `ssh` Execution is preformed by storing commands in `.sh` file and executing it via `.bash` over `ssh`
If you have issues with `ssh` connection, use this var, eg `SCRIPT_BEFORE: ls`.
This will force `known_hosts` update, adding your host via `ssh-keyscan`.
##### 10. `SCRIPT_AFTER` (optional, default '') ##### 10. `SCRIPT_AFTER` (optional, default '')
@@ -83,7 +85,7 @@ or use the latest version from a branch, eg: ssh-deploy@main
uses: easingthemes/ssh-deploy@main uses: easingthemes/ssh-deploy@main
env: env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO" ARGS: "-rlgoDzvc -i"
SOURCE: "dist/" SOURCE: "dist/"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }} REMOTE_USER: ${{ secrets.REMOTE_USER }}
@@ -124,7 +126,7 @@ jobs:
uses: easingthemes/ssh-deploy@main uses: easingthemes/ssh-deploy@main
env: env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO --delete" ARGS: "-rlgoDzvc -i --delete"
SOURCE: "dist/" SOURCE: "dist/"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }} REMOTE_USER: ${{ secrets.REMOTE_USER }}
@@ -156,6 +158,7 @@ For complex use cases, use `ARGS` and `SSH_CMD_ARGS` to fully configure `rsync`
- If you need to use multiple steps, eg multi targets deployment, save shared ENV variables in `>> $GITHUB_ENV`. - If you need to use multiple steps, eg multi targets deployment, save shared ENV variables in `>> $GITHUB_ENV`.
Check .github/workflows/e2e.yml for an example Check .github/workflows/e2e.yml for an example
- For multi sources, use -R ARG to manipulate folders structure. - For multi sources, use -R ARG to manipulate folders structure.
- Great post about `rsync` options specific to usage of this action: https://logansnotes.com/2020/gh-action-site-deploy/
## Disclaimer ## Disclaimer

View File

@@ -26,7 +26,7 @@ inputs:
ARGS: ARGS:
description: "Arguments to pass to rsync" description: "Arguments to pass to rsync"
required: false required: false
default: "-rltgoDzvO" default: "-rlgoDzvc -i"
SSH_CMD_ARGS: SSH_CMD_ARGS:
description: "An array of ssh arguments, they must be prefixed with -o and separated by a comma, for example: -o SomeArgument=no, -o SomeOtherArgument=5 " description: "An array of ssh arguments, they must be prefixed with -o and separated by a comma, for example: -o SomeArgument=no, -o SomeOtherArgument=5 "
required: false required: false

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,35 @@
## [4.0.1](https://github.com/easingthemes/ssh-deploy/compare/v4.0.0...v4.0.1) (2023-01-03)
### Bug Fixes
* fix default source if empty ([9f191f4](https://github.com/easingthemes/ssh-deploy/commit/9f191f42633c4a0f66054f0fc229c9e30a08f00c))
# [4.0.0](https://github.com/easingthemes/ssh-deploy/compare/v3.4.3...v4.0.0) (2023-01-03)
### Bug Fixes
* rebuild ([2169399](https://github.com/easingthemes/ssh-deploy/commit/2169399fef9a60a2fea1ab03cce4ec8c2371e5c2))
### Performance Improvements
* update default rsync options ([2be7efb](https://github.com/easingthemes/ssh-deploy/commit/2be7efb376866327c1d1209f51eb43f34f07b354))
### BREAKING CHANGES
* Default rsync options updated to speed up default deployments.
from `rltgoDzvO` to `-rlgoDzvc -i`
## [3.4.3](https://github.com/easingthemes/ssh-deploy/compare/v3.4.2...v3.4.3) (2023-01-03)
### Bug Fixes
* move e2e tests typo branch name ([6d3554b](https://github.com/easingthemes/ssh-deploy/commit/6d3554b01e9a05de9a9d2b30274bee411a4986ed))
## [3.4.2](https://github.com/easingthemes/ssh-deploy/compare/v3.4.1...v3.4.2) (2023-01-03) ## [3.4.2](https://github.com/easingthemes/ssh-deploy/compare/v3.4.1...v3.4.2) (2023-01-03)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@draganfilipovic/ssh-deploy", "name": "@draganfilipovic/ssh-deploy",
"version": "3.4.2", "version": "4.0.1",
"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": [

View File

@@ -13,7 +13,7 @@ const defaultInputs = {
source: './', source: './',
target: `/home/${remoteUser}/`, target: `/home/${remoteUser}/`,
exclude: '', exclude: '',
args: '-rltgoDzvO', args: '-rlgoDzvc -i',
sshCmdArgs: '-o StrictHostKeyChecking=no', sshCmdArgs: '-o StrictHostKeyChecking=no',
deployKeyName: `deploy_key_${remoteUser}_${Date.now()}` deployKeyName: `deploy_key_${remoteUser}_${Date.now()}`
}; };
@@ -30,7 +30,7 @@ inputNames.forEach((input) => {
// eslint-disable-next-line default-case // eslint-disable-next-line default-case
switch (inputName) { switch (inputName) {
case 'source': case 'source':
extendedVal = validVal.indexOf(' ') > -1 ? validVal.split(' ') : validVal; extendedVal = validVal.indexOf(' ') > -1 ? validVal.split(' ') : (validVal || './');
break; break;
case 'args': case 'args':
extendedVal = validVal.split(' '); extendedVal = validVal.split(' ');