name: Deploy to Hugging Face Space # Runs on every push to main, and can be triggered manually from the Actions tab. on: push: branches: [main] workflow_dispatch: jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 # full history so the force-push is clean lfs: false # never pull large files; the model lives in a HF model repo - name: Force-push code to the Hugging Face Space env: # HF_TOKEN is a **Write** token, stored in GitHub: # Repo -> Settings -> Secrets and variables -> Actions -> New repository secret # Name: HF_TOKEN Value: hf_xxxxxxxxxxxxxxxxxxxxx HF_TOKEN: ${{ secrets.HF_TOKEN }} HF_USERNAME: Electro0023 # your Hugging Face username SPACE_NAME: GGUF_MODEL # the Docker API Space (not the Gradio one) run: | git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" # Push the current commit to the Space's `main` branch, overwriting it. # --force is intentional: the Space repo is a deploy target, not a fork. git push --force \ "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${SPACE_NAME}.git" \ HEAD:main