# Deploy the current main branch to the Hugging Face Space as a snapshot (without binary files). # Run from the project folder: powershell -ExecutionPolicy Bypass -File scripts\deploy_hf.ps1 # Only the Space (remote "space") is force-updated. GitHub (origin) is never touched. param([string]$Remote = "space") $dirty = git status --porcelain if ($dirty) { Write-Host "There are uncommitted changes. Commit them first (git add . ; git commit -m ...)." $dirty exit 1 } $cur = git branch --show-current if ($cur -ne "main") { Write-Host "Switch to main first: git checkout main" exit 1 } if (git branch --list hf-deploy) { git branch -D hf-deploy | Out-Null } git checkout --orphan hf-deploy | Out-Null git rm --cached -q -r --ignore-unmatch -- "*.png" "*.jpg" "*.jpeg" "*.gif" "*.zip" git commit -q -m ("deploy " + (Get-Date -Format "yyyy-MM-dd HH:mm")) git push $Remote hf-deploy:main --force $code = $LASTEXITCODE git checkout -f main | Out-Null git branch -D hf-deploy | Out-Null if ($code -ne 0) { Write-Host "Push failed (exit $code)."; exit $code } Write-Host "Done. Watch the build in the Space > Logs tab."