docs: move app URL below the GIF #40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to HuggingFace Spaces | |
| on: | |
| push: | |
| branches: [master] | |
| jobs: | |
| quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout GitHub repo | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Lint | |
| run: uv run ruff check . | |
| - name: Unit tests | |
| run: uv run pytest -m "not integration" | |
| deploy: | |
| needs: quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout GitHub repo | |
| uses: actions/checkout@v4 | |
| - name: Deploy to HuggingFace Spaces | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| # Install Git LFS (HF Spaces requires it for files > 10 MiB) | |
| git lfs install | |
| # Clone the HF Space repo (contains data/ with large files) | |
| git clone https://user:$HF_TOKEN@huggingface.co/spaces/adedaran/rag-bible hf_space | |
| # Remove old code files (preserve data/ and .git/) | |
| cd hf_space | |
| find . -maxdepth 1 \ | |
| ! -name '.' \ | |
| ! -name '..' \ | |
| ! -name '.git' \ | |
| ! -name 'data' \ | |
| -exec rm -rf {} + | |
| # Copy fresh code from GitHub checkout | |
| cd .. | |
| cp README.md Dockerfile pyproject.toml uv.lock config.py app.py hf_space/ | |
| cp -r rag/ hf_space/rag/ | |
| cp -r templates/ hf_space/templates/ | |
| cp -r static/ hf_space/static/ | |
| # Commit and push if there are changes | |
| cd hf_space | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git config user.name "GitHub Actions" | |
| git lfs track "data/*.faiss" "data/*.json" "data/*.db" | |
| git add .gitattributes | |
| git add . | |
| git diff --staged --quiet || { | |
| git commit -m "Deploy from GitHub (${GITHUB_SHA::7})" | |
| git push | |
| } |