Compare commits
	
		
			No commits in common. "144fd456bace5face28b46fd37ddf1308549273c" and "68c61830b6c71b2e4280a0a075c85dac5765a150" have entirely different histories.
		
	
	
		
			144fd456ba
			...
			68c61830b6
		
	
		
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
				
			|||||||
# Rsync Copy
 | 
					# Rsync Action
 | 
				
			||||||
 | 
					
 | 
				
			||||||
***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@2.3
 | 
					uses: tempersama/rsync-action@1.4
 | 
				
			||||||
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,29 +1,30 @@
 | 
				
			|||||||
name: 'Rsync Copy'
 | 
					name: 'Rsync Action'
 | 
				
			||||||
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:
 | 
				
			||||||
  host:
 | 
					  # $1
 | 
				
			||||||
    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: 'file-text'
 | 
					  icon: 'send'
 | 
				
			||||||
  color: 'purple'
 | 
					  color: 'black'
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -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
 | 
					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 -O --stats \
 | 
						-a -v \ --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