github.com_burnett01_rsync-.../entrypoint.sh
Steven Agyekum 0370813668
fix 'mkdir: cannot create directory' error
Fix ``mkdir: cannot create directory '/github/home/.ssh': File exists`` error
2019-11-12 22:49:15 +01:00

15 lines
445 B
Bash
Executable file

#!/bin/sh
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 "$DEPLOY_KEY" > "$SSH_PATH/deploy_key"
# Set r+w to user only
chmod 600 "$SSH_PATH/deploy_key"
# Do deployment
sh -c "rsync $INPUT_SWITCHES -e 'ssh -i $SSH_PATH/deploy_key -o StrictHostKeyChecking=no' $INPUT_EXCLUDES $GITHUB_WORKSPACE/$INPUT_PATH $INPUT_UPLOAD_PATH"