@echo off REM HuggingFace Spaces Deployment Script for Windows REM This script builds the project and deploys to HuggingFace Spaces echo. echo ============================================== echo HuggingFace Spaces Deployment echo ============================================== echo. echo [1/7] Building production bundle... call npx vite build if %ERRORLEVEL% NEQ 0 ( echo. echo ERROR: Build failed! exit /b 1 ) echo. echo [2/7] Creating deployment branch... git checkout -b hf-deploy 2>nul || git checkout hf-deploy echo. echo [3/7] Cleaning workspace... for /d %%D in (*) do ( if not "%%D"=="dist" if not "%%D"==".git" rd /s /q "%%D" 2>nul ) for %%F in (*) do ( if not "%%F"=="deploy-hf.bat" if not "%%F"=="deploy-hf.sh" del /q "%%F" 2>nul ) echo. echo [4/7] Moving dist contents to root... xcopy /E /I /Y dist\* . >nul rd /s /q dist 2>nul echo. echo [5/7] Copying README.md... git checkout main -- README.md echo. echo [6/7] Committing changes... git add -A git commit -m "Deploy to HuggingFace Spaces - %date% %time%" echo. echo [7/7] Pushing to HuggingFace Spaces... git push huggingface hf-deploy:main --force if %ERRORLEVEL% NEQ 0 ( echo. echo ERROR: Push failed! You may need to authenticate with HuggingFace. echo. echo Please authenticate by visiting: echo https://huggingface.co/settings/tokens echo. echo Then run: git config credential.helper store git checkout main exit /b 1 ) echo. echo [DONE] Returning to main branch... git checkout main echo. echo ============================================== echo Deployment Complete! echo ============================================== echo. echo Your Space is live at: echo https://huggingface.co/spaces/Chunte/Thumbnail_miniCrafter echo. pause