Stock-Tool/release_stable.bat

61 lines
1.5 KiB
Batchfile

@echo off
setlocal
echo ============================================================
echo Release STABLE (code deploy + exe build + user update)
echo ============================================================
echo.
set /p COMMIT_MSG=Commit message:
if "%COMMIT_MSG%"=="" (
echo Error: Commit message cannot be empty.
pause
exit /b 1
)
set /p RELEASE_NOTES=Release notes (shown to users, press Enter to skip):
echo.
echo [1/5] Staging all changes...
git add -A
echo [2/5] Committing...
git commit -m "%COMMIT_MSG%"
if errorlevel 1 (
echo Nothing to commit — continuing to build.
)
echo [3/5] Pushing to Gitea main branch...
git push gitea main
if errorlevel 1 (
echo Push failed. Check Gitea connection.
pause
exit /b 1
)
echo [4/5] Deploying server-side files 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. Check SSH connection.
pause
exit /b 1
)
echo [5/5] Building exe and pushing update to users...
if "%RELEASE_NOTES%"=="" (
python push_update.py --channel stable
) else (
python push_update.py --channel stable --notes "%RELEASE_NOTES%"
)
if errorlevel 1 (
echo Exe build or upload failed.
pause
exit /b 1
)
echo.
echo ============================================================
echo Stable release complete. Users will update on next launch.
echo ============================================================
pause