Add step to reset local changes on VPS before deployment
This commit is contained in:
13
.github/workflows/deploy.yml
vendored
13
.github/workflows/deploy.yml
vendored
@@ -37,6 +37,19 @@ jobs:
|
||||
run: |
|
||||
ssh -p "${{ secrets.SSH_PORT }}" "${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}" "sudo mkdir -p '${REMOTE_DIR}' && sudo chown -R \$USER:\$USER '${REMOTE_DIR}'"
|
||||
|
||||
- name: Reset any local changes on VPS
|
||||
run: |
|
||||
ssh -p "${{ secrets.SSH_PORT }}" "${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}" \
|
||||
"export REMOTE_DIR='${{ secrets.REMOTE_DIR }}'; bash -se" <<'EOF'
|
||||
set -euo pipefail
|
||||
cd "$REMOTE_DIR"
|
||||
# Reset any local changes if this is a git repository
|
||||
if [ -d ".git" ]; then
|
||||
git reset --hard HEAD
|
||||
git clean -fd
|
||||
fi
|
||||
EOF
|
||||
|
||||
- name: Sync repo to VPS (rsync)
|
||||
run: |
|
||||
rsync -az --delete \
|
||||
|
||||
Reference in New Issue
Block a user