chore: remove unnecessary git configuration from Hugging Face deploym… #3
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 to Hugging Face | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Configure Hugging Face | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| HF_USERNAME: ${{ secrets.HF_USERNAME }} | |
| run: | | |
| # Install Hugging Face CLI | |
| pip install huggingface-hub | |
| # Login to Hugging Face | |
| huggingface-cli login --token $HF_TOKEN --add-to-git-credential | |
| - name: Push to Hugging Face | |
| env: | |
| HF_USERNAME: ${{ secrets.HF_USERNAME }} | |
| SPACE_NAME: ${{ secrets.SPACE_NAME }} | |
| run: | | |
| # Create repository URL | |
| REPO_URL="https://huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME" | |
| # Add Hugging Face as a remote and push | |
| git remote add space $REPO_URL || git remote set-url space $REPO_URL | |
| git push -f space main |