Spaces:
Sleeping
Sleeping
| name: Deploy to HF Space | |
| # A Docker Space rebuilds from the Dockerfile inside the Space repo: it cannot | |
| # pull the GHCR image directly. GHCR remains the CI artifact / portability story; | |
| # this job syncs the exact same repo (same Dockerfile) to the Space. | |
| # | |
| # One-time setup: | |
| # 1. Create a Docker Space on Hugging Face (SDK: Docker, hardware: cpu-basic). | |
| # 2. GitHub repo -> Settings > Secrets : HF_TOKEN (write token) | |
| # 3. GitHub repo -> Settings > Variables: HF_SPACE = "<hf-username>/<space-name>" | |
| # 4. HF Space -> Settings > Variables/Secrets: LLM_PROVIDER, LLM_MODEL, LLM_API_KEY, | |
| # GRADIO_AUTH_USERNAME, GRADIO_AUTH_PASSWORD | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| if: ${{ vars.HF_SPACE != '' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Push to Space | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| HF_SPACE: ${{ vars.HF_SPACE }} | |
| run: | | |
| HF_USER="${HF_SPACE%%/*}" | |
| git push --force "https://${HF_USER}:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}" HEAD:main | |