| name: Sync to Hugging Face Spaces | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Push to HF Spaces | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| if [ -z "$HF_TOKEN" ]; then | |
| echo "::error::HF_TOKEN secret is missing or empty on GitHub! Please go to Settings -> Secrets and Variables -> Actions on your GitHub repository, and add HF_TOKEN with your Hugging Face write token." | |
| exit 1 | |
| fi | |
| git config user.email "action@github.com" | |
| git config user.name "GitHub Action" | |
| git lfs install --local | |
| git remote add hf "https://suplo6669:${HF_TOKEN}@huggingface.co/spaces/suplo6669/Enhancer" | |
| git lfs push --all hf main | |
| git push hf main:main | |