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`***
|
***By `temper`***
|
||||||
|
|
||||||
@ -30,13 +30,13 @@ It is recommended to pass all sensitive values through `secrets`
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Copy single file
|
name: Copy single file
|
||||||
uses: tempersama/rsync-action@1.4
|
uses: tempersama/rsync-action@2.3
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.host }}
|
host: ${{ secrets.host }}
|
||||||
source: html/
|
source: html/
|
||||||
destination: /opt/nginx/website.com
|
destination: /opt/nginx/website.com
|
||||||
username: ${{ secrets.username }}
|
username: ${{ secrets.username }}
|
||||||
key: ${{ secrets.SERVER_KEY }}
|
key: ${{ secrets.SERVER_KEY }}
|
||||||
port: 2222
|
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'
|
description: 'Copies the files from your repository to a remote host using rsync'
|
||||||
author: 'temper'
|
author: 'temper'
|
||||||
inputs:
|
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:
|
port:
|
||||||
description: 'Port for SCP'
|
description: 'Port for SCP'
|
||||||
default: 22
|
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:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
branding:
|
branding:
|
||||||
icon: 'send'
|
icon: 'file-text'
|
||||||
color: 'black'
|
color: 'purple'
|
||||||
|
|
||||||
|
@ -1,24 +1,15 @@
|
|||||||
#!/bin/sh -l -e
|
#!/bin/sh -l
|
||||||
|
|
||||||
# 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
|
echo -e "${INPUT_KEY}" > key
|
||||||
chmod 400 key
|
chmod 400 key
|
||||||
|
|
||||||
# TODO: make sure we are not just blindly using StrictHostKeyChecking=no
|
# TODO: make sure we are not just blindly using StrictHostKeyChecking=no
|
||||||
rsync \
|
rsync \
|
||||||
-a -v \ --stats \
|
-a -v -O --stats \
|
||||||
-e "ssh -o StrictHostKeyChecking=no -i key" \
|
-e "ssh -o StrictHostKeyChecking=no -i key" \
|
||||||
--port $INPUT_PORT \
|
--port "$INPUT_PORT" \
|
||||||
"$INPUT_SOURCE" \
|
"$INPUT_SOURCE" \
|
||||||
"$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"
|
"$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user