name: Deploy FastAPI to Hugging Face Spaces on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Install Hugging Face CLI run: pip install huggingface_hub - name: Authenticate with Hugging Face env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: huggingface-cli login --token "$HF_TOKEN" - name: Clone Hugging Face Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | git clone https://user:$HF_TOKEN@huggingface.co/spaces/Prathamesh1420/fastapi-chatbot mv fastapi-chatbot hf_space rsync -av --exclude=hf_space --exclude=.git ./ hf_space/ cd hf_space # Set Git User Identity git config --global user.email "no-reply@github.com" git config --global user.name "Prathamesh Khade" git add . git commit -m "Deploy new version" git push