Compare commits

..

No commits in common. "144fd456bace5face28b46fd37ddf1308549273c" and "68c61830b6c71b2e4280a0a075c85dac5765a150" have entirely different histories.

3 changed files with 42 additions and 32 deletions

View File

@ -1,4 +1,4 @@
# Rsync Copy
# Rsync Action
***By `temper`***
@ -30,13 +30,13 @@ It is recommended to pass all sensitive values through `secrets`
```yaml
name: Copy single file
uses: tempersama/rsync-action@2.3
uses: tempersama/rsync-action@1.4
with:
host: ${{ secrets.host }}
source: html/
destination: /opt/nginx/website.com
username: ${{ secrets.username }}
key: ${{ secrets.SERVER_KEY }}
port: 2222
host: ${{ secrets.host }}
source: html/
destination: /opt/nginx/website.com
username: ${{ secrets.username }}
key: ${{ secrets.SERVER_KEY }}
port: 2222
```

View File

@ -1,29 +1,30 @@
name: 'Rsync Copy'
name: 'Rsync Action'
description: 'Copies the files from your repository to a remote host using rsync'
author: 'temper'
inputs:
host:
description: 'IP Address or DNS of your target host'
required: true
source:
description: 'Source route folder'
required: true
destination:
description: 'Destination route folder'
required: true
username:
description: 'User for remote connection'
required: true
key:
description: 'Private SSH key'
required: true
# $1
port:
description: 'Port for SCP'
default: 22
# $2
host:
description: 'IP Address or DNS of your target host'
# $3
source:
description: 'Source route folder'
default: "./*"
# $4
destination:
description: 'Destination route folder'
# $5
username:
description: 'User for remote connection'
# $7
key:
description: 'Private SSH key'
runs:
using: 'docker'
image: 'Dockerfile'
branding:
icon: 'file-text'
color: 'purple'
icon: 'send'
color: 'black'

View File

@ -1,15 +1,24 @@
#!/bin/sh -l
#!/bin/sh -l -e
# Quick checks for missing parameters
rc=0
empty() { echo ERROR: $1 is empty }
[[ "$INPUT_HOST" ]] && empty host
[[ "$INPUT_SOURCE" ]] && empty source
[[ "$INPUT_DESTINATION" ]] && empty destination
[[ "$INPUT_USERNME" ]] && empty username
[[ "$INPUT_KEY" ]] && empty key
set -e
echo -e "${INPUT_KEY}" > key
chmod 400 key
# TODO: make sure we are not just blindly using StrictHostKeyChecking=no
rsync \
-a -v -O --stats \
-a -v \ --stats \
-e "ssh -o StrictHostKeyChecking=no -i key" \
--port "$INPUT_PORT" \
--port $INPUT_PORT \
"$INPUT_SOURCE" \
"$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"