Spaces:
Runtime error
Runtime error
name: Sync to Hugging Face Hub | |
on: | |
push: | |
branches: [ codespace-crispy-fishstick-g4g6pw9rg4v2w97 ] | |
workflow_dispatch: | |
jobs: | |
sync-to-hub: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Checkout code & LFS | |
- name: Checkout code with Git LFS | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
# 2. Remove venv để tránh push file lớn | |
- name: Remove virtual environment folder | |
run: | | |
git rm -r --cached venv || echo "venv not tracked" | |
echo "venv/" >> .gitignore | |
git add .gitignore | |
git commit -m "Remove venv before deploy" || echo "Nothing to commit" | |
# 3. Dọn sạch workspace để tránh lỗi uncommitted changes | |
- name: Clean workspace | |
run: | | |
git reset --hard | |
git clean -fd | |
# 4. Thiết lập Git LFS và remote HF | |
- name: Setup Git LFS & add HF remote | |
env: | |
GIT_LFS_SKIP_SMUDGE: 1 | |
run: | | |
git lfs install | |
git config user.name "github-actions" | |
git config user.email "actions@github.com" | |
# Thêm remote hf với token | |
git remote add hf https://danghungithp:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/danghungithp/vsa | |
# 5. Push force từ branch codespace-… lên main của HF | |
- name: Force-push to Hugging Face Space | |
env: | |
GIT_LFS_SKIP_SMUDGE: 1 | |
run: | | |
git push hf codespace-crispy-fishstick-g4g6pw9rg4v2w97:main --force | |