rsync-deployments/entrypoint.sh

18 lines
430 B
Bash
Raw Normal View History

2020-01-05 12:11:59 +01:00
#!/bin/sh
2019-02-09 14:17:45 +01:00
2020-01-05 12:06:14 +01:00
# Start the SSH agent and load key.
source agent-start "$GITHUB_ACTION"
echo "$INPUT_REMOTE_KEY" | agent-add
2019-02-09 14:17:45 +01:00
2020-06-22 21:40:12 +02:00
# Add strict errors.
2020-01-05 12:19:21 +01:00
set -eu
2020-06-22 21:40:12 +02:00
# Variables.
SWITCHES="$INPUT_SWITCHES"
RSH="ssh -o StrictHostKeyChecking=no -p $INPUT_REMOTE_PORT $INPUT_RSH"
LOCAL_PATH="$GITHUB_WORKSPACE/$INPUT_PATH"
DSN="$INPUT_REMOTE_USER@$INPUT_REMOTE_HOST"
# Deploy.
sh -c "rsync $SWITCHES -e '$RSH' $LOCAL_PATH $DSN:$INPUT_REMOTE_PATH"