fix 'mkdir: cannot create directory' error

Fix ``mkdir: cannot create directory '/github/home/.ssh': File exists`` error
This commit is contained in:
Steven Agyekum 2019-11-12 22:49:15 +01:00 committed by GitHub
parent 8ad6165315
commit 0370813668
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,10 +4,12 @@ set -eu
# Set deploy key
SSH_PATH="$HOME/.ssh"
mkdir "$SSH_PATH"
# 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"