Stock-Tool/deploy_stable.bat

49 lines
1.1 KiB
Batchfile

@echo off
setlocal
echo ============================================================
echo Deploy to STABLE (main branch + /srv/stock-tool on VPS)
echo ============================================================
echo.
set /p COMMIT_MSG=Commit message:
if "%COMMIT_MSG%"=="" (
echo Error: Commit message cannot be empty.
pause
exit /b 1
)
echo.
echo [1/4] Staging all changes...
git add -A
echo [2/4] Committing...
git commit -m "%COMMIT_MSG%"
if errorlevel 1 (
echo Nothing to commit.
pause
exit /b 0
)
echo [3/4] Pushing to Gitea main branch...
git push gitea main
if errorlevel 1 (
echo Push failed. Check Gitea connection.
pause
exit /b 1
)
echo [4/4] Deploying to VPS...
ssh root@87.99.133.95 "cd /srv/stock-tool && git pull && cp api/main.py /srv/api/main.py && cp health_monitor.py /srv/health_monitor.py && pm2 restart api && echo VPS deploy OK"
if errorlevel 1 (
echo VPS deploy failed. SSH in and check manually.
pause
exit /b 1
)
echo.
echo ============================================================
echo Stable deploy complete.
echo ============================================================
pause