@echo off
setlocal enabledelayedexpansion

:: --- НАСТРОЙКИ ---
set REMOTE_HOST=148.230.71.134
set REMOTE_USER=root
:: -----------------

echo [1/3] 🚀 Otprafka koda v Git...
git add .
git commit -m "auto deploy"
git push origin master
if %ERRORLEVEL% neq 0 (echo Push failed! & exit /b %ERRORLEVEL%)

echo [2/3] ⚙️ Zapusk sborki na servere...
ssh %REMOTE_USER%@%REMOTE_HOST% "cd /var/www/radionica3d && git pull && npm install && ./build_frontend.sh && source backend/venv/bin/activate && pip install -r backend/requirements.txt && sudo systemctl restart radionica-backend && sudo systemctl restart nginx && sudo chown -R www-data:www-data /var/www/radionica3d"

echo.
echo 🎉 DEPLOY CHEREZ GIT USPESHNO ZAVERSHEN!
pause
