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'
|
"export REMOTE_DIR='${{ secrets.REMOTE_DIR }}'; bash -se" <<'EOF'
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cd "$REMOTE_DIR"
|
cd "$REMOTE_DIR"
|
||||||
# Force reset any local changes regardless of git status
|
# Force reset any local changes and pull latest
|
||||||
if [ -d ".git" ]; then
|
if [ -d ".git" ]; then
|
||||||
echo "Git repository detected, resetting changes..."
|
echo "Git repository detected, resetting and pulling..."
|
||||||
git reset --hard HEAD 2>/dev/null || true
|
git reset --hard HEAD
|
||||||
git clean -fd 2>/dev/null || true
|
git clean -fd
|
||||||
git checkout main 2>/dev/null || git checkout master 2>/dev/null || true
|
git pull origin main
|
||||||
else
|
else
|
||||||
echo "No git repository found, creating backup of modified files..."
|
echo "No git repository found, creating backup of modified files..."
|
||||||
# Backup any existing files that might conflict
|
# Backup any existing files that might conflict
|
||||||
|
|||||||
Reference in New Issue
Block a user