mirror of
				https://github.com/Burnett01/rsync-deployments.git
				synced 2025-11-04 09:29:04 +01:00 
			
		
		
		
	
						commit
						c39ab06b30
					
				
					 2 changed files with 9 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -1,10 +1,7 @@
 | 
			
		|||
FROM alpine:latest
 | 
			
		||||
 | 
			
		||||
# Update
 | 
			
		||||
RUN apk --update --no-cache add rsync bash openssh-client
 | 
			
		||||
FROM drinternet/rsync:1.0.1
 | 
			
		||||
 | 
			
		||||
# Copy entrypoint
 | 
			
		||||
ADD entrypoint.sh /entrypoint.sh
 | 
			
		||||
COPY entrypoint.sh /entrypoint.sh
 | 
			
		||||
RUN chmod +x /entrypoint.sh
 | 
			
		||||
 | 
			
		||||
ENTRYPOINT ["/entrypoint.sh"]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,18 +1,9 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
# Start the SSH agent and load key.
 | 
			
		||||
source agent-start "$GITHUB_ACTION"
 | 
			
		||||
echo "$INPUT_REMOTE_KEY" | agent-add
 | 
			
		||||
 | 
			
		||||
# Add strict errors and deploy.
 | 
			
		||||
set -eu
 | 
			
		||||
 | 
			
		||||
# Set deploy key
 | 
			
		||||
SSH_PATH="$HOME/.ssh"
 | 
			
		||||
 | 
			
		||||
# Create .ssh dir if it doesn't exist
 | 
			
		||||
[ -d "$SSH_PATH" ] || mkdir "$SSH_PATH"
 | 
			
		||||
 | 
			
		||||
# Place deploy_key into .ssh dir
 | 
			
		||||
echo "$INPUT_REMOTE_KEY" > "$SSH_PATH/key"
 | 
			
		||||
 | 
			
		||||
# Set r+w to user only
 | 
			
		||||
chmod 600 "$SSH_PATH/key"
 | 
			
		||||
 | 
			
		||||
# Do deployment
 | 
			
		||||
sh -c "rsync $INPUT_SWITCHES -e 'ssh -i $SSH_PATH/key -o StrictHostKeyChecking=no -p $INPUT_REMOTE_PORT $INPUT_RSH' $GITHUB_WORKSPACE/$INPUT_PATH $INPUT_REMOTE_USER@$INPUT_REMOTE_HOST:$INPUT_REMOTE_PATH"
 | 
			
		||||
sh -c "rsync $INPUT_SWITCHES -e 'ssh -o StrictHostKeyChecking=no -p $INPUT_REMOTE_PORT $INPUT_RSH' $GITHUB_WORKSPACE/$INPUT_PATH $INPUT_REMOTE_USER@$INPUT_REMOTE_HOST:$INPUT_REMOTE_PATH"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue