| name: Deploy to Hugging Face Space | |
| on: | |
| pull_request: | |
| branches: [main] | |
| types: [closed] | |
| env: | |
| HF_USERNAME: rassulya | |
| HF_SPACE: test_cicd | |
| jobs: | |
| deploy: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source repo | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| fetch-depth: 0 | |
| - name: Push to HF Space | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| # Use the correct syntax for variables and push HEAD to main for clarity | |
| git push --force https://${{ env.HF_USERNAME }}:${HF_TOKEN}@huggingface.co/spaces/${{ env.HF_USERNAME }}/${{ env.HF_SPACE }} HEAD:main |