Compare commits
10 Commits
68c61830b6
...
144fd456ba
Author | SHA1 | Date | |
---|---|---|---|
144fd456ba | |||
9733f66e78 | |||
731c33a2e9 | |||
6333f32c32 | |||
fd7c104073 | |||
ca642a2f1c | |||
37b4e77655 | |||
80ffad571c | |||
83dc8139d6 | |||
7585482de6 |
16
README.md
16
README.md
@ -1,4 +1,4 @@
|
||||
# Rsync Action
|
||||
# Rsync Copy
|
||||
|
||||
***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@1.4
|
||||
uses: tempersama/rsync-action@2.3
|
||||
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
|
||||
```
|
||||
|
||||
|
39
action.yml
39
action.yml
@ -1,30 +1,29 @@
|
||||
name: 'Rsync Action'
|
||||
name: 'Rsync Copy'
|
||||
description: 'Copies the files from your repository to a remote host using rsync'
|
||||
author: 'temper'
|
||||
inputs:
|
||||
# $1
|
||||
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
|
||||
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: 'send'
|
||||
color: 'black'
|
||||
icon: 'file-text'
|
||||
color: 'purple'
|
||||
|
||||
|
@ -1,24 +1,15 @@
|
||||
#!/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
|
||||
|
||||
#!/bin/sh -l
|
||||
|
||||
set -e
|
||||
|
||||
echo -e "${INPUT_KEY}" > key
|
||||
chmod 400 key
|
||||
|
||||
# TODO: make sure we are not just blindly using StrictHostKeyChecking=no
|
||||
rsync \
|
||||
-a -v \ --stats \
|
||||
-a -v -O --stats \
|
||||
-e "ssh -o StrictHostKeyChecking=no -i key" \
|
||||
--port $INPUT_PORT \
|
||||
--port "$INPUT_PORT" \
|
||||
"$INPUT_SOURCE" \
|
||||
"$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user