Stock-Tool/release_beta.bat

61 lines
1.6 KiB
Batchfile

@echo off
setlocal
echo ============================================================
echo Release BETA (code deploy + exe build + beta 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 beta branch...
git push gitea HEAD:beta
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-beta && git pull origin beta && cp api/main.py /srv/api/main.py && cp health_monitor.py /srv/health_monitor.py && pm2 restart api && echo VPS beta 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 beta users...
if "%RELEASE_NOTES%"=="" (
python push_update.py --channel beta
) else (
python push_update.py --channel beta --notes "%RELEASE_NOTES%"
)
if errorlevel 1 (
echo Exe build or upload failed.
pause
exit /b 1
)
echo.
echo ============================================================
echo Beta release complete. Beta users will update on next launch.
echo ============================================================
pause