2019-02-09 21:17:45 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
# Set deploy key
|
|
|
|
SSH_PATH="$HOME/.ssh"
|
2019-11-13 05:49:15 +08:00
|
|
|
# Create .ssh dir if it doesn't exist
|
2019-11-13 05:55:41 +08:00
|
|
|
if [ ! -d "$SSH_PATH" ]; then
|
|
|
|
mkdir "$SSH_PATH"
|
|
|
|
fi
|
2019-11-13 05:49:15 +08:00
|
|
|
# Place deploy_key into .ssh dir
|
2019-02-09 21:17:45 +08:00
|
|
|
echo "$DEPLOY_KEY" > "$SSH_PATH/deploy_key"
|
2019-11-13 05:49:15 +08:00
|
|
|
# Set r+w to user only
|
2019-02-09 21:17:45 +08:00
|
|
|
chmod 600 "$SSH_PATH/deploy_key"
|
|
|
|
|
|
|
|
# Do deployment
|
2019-11-22 07:28:06 +08:00
|
|
|
sh -c "rsync $INPUT_SWITCHES -e 'ssh -i $SSH_PATH/deploy_key -o StrictHostKeyChecking=no $INPUT_RSH' $GITHUB_WORKSPACE/$INPUT_PATH $INPUT_UPLOAD_PATH"
|