added more logging to find error #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy API to Hugging Face Spaces | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "api/**" | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: api | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| pip install uv | |
| uv pip install --system --no-cache-dir . | |
| # - name: Run tests | |
| # run: | | |
| # python -m pytest tests/ -v | |
| - name: Install HF CLI | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade huggingface_hub | |
| - name: Deploy to Hugging Face Spaces | |
| run: | | |
| git init | |
| git config user.name "GitHub Actions" | |
| git config user.email "[email protected]" | |
| git add . | |
| git commit -m "Deploy to HF Spaces: $(date -u +'%Y-%m-%d %H:%M:%S UTC')" | |
| git branch -M main | |
| - name: Push to existing Space | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| HF_USERNAME: ${{ secrets.HF_USERNAME }} | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }} | |
| run: | | |
| set -e | |
| # Build tokenized remote URL | |
| HF_SPACE_URL="https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME}.git" | |
| # Add or update the remote and push local main -> remote main | |
| git remote add origin "$HF_SPACE_URL" 2>/dev/null || git remote set-url origin "$HF_SPACE_URL" | |
| git push -f origin main |