name: Deploy to Hugging Face Spaces on: push: branches: - main workflow_dispatch: jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Hugging Face CLI run: pip install huggingface_hub - name: Login to Hugging Face env: HF: ${{ secrets.HG }} run: huggingface-cli login --token ${{ secrets.HG }} --add-to-git-credential - name: Add remote run: git remote add huggingface https://huggingface.co/spaces/MYousafRana/Demo - name: Set up Hugging Face credentials run: | git config --global credential.helper store echo "https://huggingface.co:${{ secrets.HG }}@huggingface.co" > ~/.git-credentials - name: Push to Hugging Face Space run: git push --force huggingface main