Spaces:
Running
Running
| name: Deploy to Hugging Face Space | |
| on: | |
| push: | |
| branches: | |
| - main # hoặc branch bạn dùng | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Set up Git | |
| run: | | |
| git config --global user.email "actions@github.com" | |
| git config --global user.name "GitHub Actions" | |
| - name: Push to Hugging Face Spaces | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| git clone https://huggingface.co/spaces/DucLai/Vietnamese_NER space | |
| # Đồng bộ code vào repo Space (không copy .git) | |
| rsync -av --exclude '.git' ./ space/ | |
| # Xoá file binary ra khỏi Git index trước khi commit | |
| cd space | |
| find . -type f \( \ | |
| -iname "*.png" -o \ | |
| -iname "*.jpg" -o \ | |
| -iname "*.jpeg" -o \ | |
| -iname "*.mp4" -o \ | |
| -iname "*.zip" -o \ | |
| -iname "*.pth" -o \ | |
| -iname "*.h5" -o \ | |
| -iname "*.tar.gz" -o \ | |
| -iname "*.wav" \ | |
| \) -exec git rm --cached {} \; || true | |
| # Commit và push | |
| git add . | |
| git commit -m "Auto-deploy from GitHub (binary files removed)" || echo "No changes to commit" | |
| git push https://DucLai:${HF_TOKEN}@huggingface.co/spaces/DucLai/Vietnamese_NER HEAD | |