Spaces:
Running
Running
Download scripts/deploy_hf.ps1 from lilyjeongwon/math-tutor: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/spaces/lilyjeongwon/math-tutor/resolve/main/scripts/deploy_hf.ps1
- Command line
-
hf download hf://spaces/lilyjeongwon/math-tutor/scripts/deploy_hf.ps1
-
curl -L -o deploy_hf.ps1 https://huggingface.co/spaces/lilyjeongwon/math-tutor/resolve/main/scripts/deploy_hf.ps1
1.14 kB
| # 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." | |