Merge pull request #96 from easingthemes/feature/default-rsync-options

feat: update default rsync options
main
Dragan Filipović 2023-01-03 09:33:49 +01:00 committed by GitHub
commit 7c9b40539e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 8 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

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

@ -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()}`
}; };