resume-server / deploy.bat
hari7775's picture
all server bugs fixed
a475ac0
Raw History Blame Contribute Delete
2.45 kB
@echo off
setlocal enabledelayedexpansion
echo ===================================================
echo Resume Generator Automation Build ^& Deploy Script
echo ===================================================
:: 1. Check if Docker is running
echo Checking if Docker is running...
docker ps >nul 2>&1
if errorlevel 1 (
echo Docker daemon is not running. Starting Docker Desktop...
if exist "C:\Program Files\Docker\Docker\Docker Desktop.exe" (
start "" "C:\Program Files\Docker\Docker\Docker Desktop.exe"
) else (
echo [WARNING] Docker Desktop not found in default path. Please start Docker manually.
)
echo Waiting 20 seconds for Docker daemon to initialize...
timeout /t 20 /nobreak
) else (
echo Docker daemon is already running.
)
:: 2. Build the local Docker image
echo.
echo Building Docker image locally...
docker build -t resume-generator .
if %errorlevel% neq 0 (
echo.
echo [ERROR] Docker build failed. Aborting deployment.
pause
exit /b %errorlevel%
)
echo.
echo [SUCCESS] Local Docker build succeeded!
echo ===================================================
:: 3. Extract current version from package.json using PowerShell
set "CURRENT_VERSION=Unknown"
for /f "usebackq tokens=*" %%i in (`powershell -Command "$json = Get-Content package.json | Out-String | ConvertFrom-Json; $json.version"`) do (
set "CURRENT_VERSION=%%i"
)
echo Previous version: %CURRENT_VERSION%
echo.
:: 4. Ask user for version update
set /p "NEW_VERSION=Enter new version: "
if not "!NEW_VERSION!"=="" (
echo Updating version in package.json to !NEW_VERSION!...
powershell -Command "$json = Get-Content package.json | Out-String | ConvertFrom-Json; $json.version = '!NEW_VERSION!'; $json | ConvertTo-Json -Depth 10 | Set-Content package.json"
set "VERSION_TO_USE=!NEW_VERSION!"
) else (
set "VERSION_TO_USE=%CURRENT_VERSION%"
)
:: 5. Ask user for commit message
echo.
set /p "COMMIT_MSG=Enter Git commit message: "
if "!COMMIT_MSG!"=="" (
set "COMMIT_MSG=Deploy: Updated generator logic (v!VERSION_TO_USE!)"
)
:: 6. Git Push to Hugging Face Space
echo.
echo Pushing changes to Hugging Face...
git add .
git commit -m "!COMMIT_MSG!"
git push origin main --force
if %errorlevel% neq 0 (
echo.
echo [ERROR] Git push to Hugging Face failed.
pause
exit /b %errorlevel%
)
echo.
echo [SUCCESS] Deployment to Hugging Face completed successfully!
pause