name: Sync to HuggingFace Space # Pushes the repo to the HF Space on every merge to main. # The Space builds from the Dockerfile; models are NOT in the repo — # they are downloaded at startup from HF Hub using the env vars and # HF_TOKEN secret configured in the Space settings. # # One-time setup: # 1. Create the Space: huggingface.co/new-space # Name: guichetoi-ml | SDK: Docker | Visibility: Public or Private # 2. Create an HF token: huggingface.co/settings/tokens # Scope: write (to push to the Space repo) # 3. Add HF_TOKEN as a GitHub repo secret: # Repo → Settings → Secrets → Actions → New secret named HF_TOKEN on: push: branches: [main] jobs: sync-to-hf: name: Sync to HuggingFace Space runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # full history so git push works cleanly - name: Push to HuggingFace Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | git config user.email "ci@github" git config user.name "GitHub CI" # HF Space repo URL — update the Space name if you named it differently git remote add hf-space \ https://AzizMiladi:${HF_TOKEN}@huggingface.co/spaces/AzizMiladi/FiberGate # Force-push: HF Space repo diverges from GitHub due to HF's own # metadata commits. --force-with-lease would fail here. git push hf-space main --force