Enhance deployment script to force reset local changes and pull latest from main branch
This commit is contained in:
10
.github/workflows/deploy.yml
vendored
10
.github/workflows/deploy.yml
vendored
@@ -42,12 +42,12 @@ jobs:
|
||||
"export REMOTE_DIR='${{ secrets.REMOTE_DIR }}'; bash -se" <<'EOF'
|
||||
set -euo pipefail
|
||||
cd "$REMOTE_DIR"
|
||||
# Force reset any local changes regardless of git status
|
||||
# Force reset any local changes and pull latest
|
||||
if [ -d ".git" ]; then
|
||||
echo "Git repository detected, resetting changes..."
|
||||
git reset --hard HEAD 2>/dev/null || true
|
||||
git clean -fd 2>/dev/null || true
|
||||
git checkout main 2>/dev/null || git checkout master 2>/dev/null || true
|
||||
echo "Git repository detected, resetting and pulling..."
|
||||
git reset --hard HEAD
|
||||
git clean -fd
|
||||
git pull origin main
|
||||
else
|
||||
echo "No git repository found, creating backup of modified files..."
|
||||
# Backup any existing files that might conflict
|
||||
|
||||
Reference in New Issue
Block a user