| name: Sync to Hugging Face Space | |
| on: | |
| push: | |
| branches: [main] | |
| # to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| sync-to-hub: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Required for history rewriting | |
| lfs: true # Enable Git LFS support | |
| - name: Install git-filter-repo | |
| run: pip install git-filter-repo | |
| - name: Remove large file from history | |
| run: git filter-repo --path "Rag_Documents/layout-parser-paper.pdf" --invert-paths --force | |
| - name: Log in to Hugging Face Hub | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| pip install -U "huggingface_hub>=0.20.0" | |
| git config --global credential.helper store | |
| echo "https://bpratik:$HF_TOKEN@huggingface.co" > ~/.git-credentials | |
| - name: Push to hub | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| git remote add hf https://huggingface.co/spaces/bpratik/Chatbot | |
| git push --force hf main |