diff --git a/deploy.sh b/deploy.sh index 58ac17a..e9dad38 100755 --- a/deploy.sh +++ b/deploy.sh @@ -83,6 +83,16 @@ elif [ -d "$REMOTE_DIR/.envs" ]; then cp -r "$REMOTE_DIR/.envs" /tmp/.envs-backup fi +# Backup .ssh if it exists (SSH keys not in git) +if [ -d "$REMOTE_DIR/smoothschedule/.ssh" ]; then + echo ">>> Backing up .ssh keys..." + cp -r "$REMOTE_DIR/smoothschedule/.ssh" /tmp/.ssh-backup +elif [ -d "$REMOTE_DIR/.ssh" ]; then + # Old structure + echo ">>> Backing up .ssh keys (old location)..." + cp -r "$REMOTE_DIR/.ssh" /tmp/.ssh-backup +fi + if [ ! -d "$REMOTE_DIR/.git" ]; then echo ">>> Cloning repository for the first time..." # Remove old non-git deployment if exists @@ -106,6 +116,13 @@ if [ -d /tmp/.envs-backup ]; then rm -rf /tmp/.envs-backup fi +# Restore .ssh keys +if [ -d /tmp/.ssh-backup ]; then + echo ">>> Restoring .ssh keys..." + cp -r /tmp/.ssh-backup "$REMOTE_DIR/smoothschedule/.ssh" + rm -rf /tmp/.ssh-backup +fi + echo ">>> Current commit:" git log -1 --oneline