diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 32ff84a..7606b87 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,8 +34,20 @@ jobs: echo "🔧 Fixing repository permissions..." sudo chown -R $USER:$USER . + # Stash any local changes before pulling + if ! git diff-files --quiet || ! git diff-index --quiet --cached HEAD; then + echo "💾 Stashing local changes..." + git stash push -m "Auto-stash before deployment $(date +%Y%m%d-%H%M%S)" + fi + git pull origin main + # Reapply stashed changes if any (optional - comment out if not needed) + # if git stash list | grep -q "Auto-stash"; then + # echo "♻️ Reapplying stashed changes..." + # git stash pop || echo "⚠️ Could not reapply stash (conflicts?)" + # fi + echo "🔄 Restarting service..." sudo systemctl restart $SERVICE_NAME