name: Deploy to Hugging Face Spaces on: push: branches: - main # Change this if your default branch is different jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 with: fetch-depth: 0 # Fetch the entire history of the repository - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.10" - name: Install dependencies run: | pip install huggingface_hub - name: Configure huggingface-cli run: | huggingface-cli login --token ${{ secrets.HF_TOKEN }} - name: Set up Git run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - name: Add Hugging Face remote run: | git remote add huggingface https://huggingface:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/AnnsKhan/billion_row_challenge - name: Fetch and reset to main run: | git fetch huggingface git reset --hard origin/main - name: Push to Hugging Face Hub run: | git push huggingface main --force