name: Deploy to Hugging Face Spaces on: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build test image run: docker build --target backend-test -t paperchat-test . - name: Run tests run: | docker run --rm \ -e JINA_API_KEY=dummy \ -e GROQ_API_KEY=dummy \ -e COHERE_API_KEY=dummy \ paperchat-test \ python -m pytest tests/ -x -q deploy: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Validate secrets env: HF_TOKEN: ${{ secrets.HF_TOKEN }} HF_USERNAME: ${{ secrets.HF_USERNAME }} HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }} run: | [[ -n "$HF_TOKEN" ]] || { echo "HF_TOKEN secret is not set"; exit 1; } [[ -n "$HF_USERNAME" ]] || { echo "HF_USERNAME secret is not set"; exit 1; } [[ -n "$HF_SPACE_NAME" ]] || { echo "HF_SPACE_NAME secret is not set"; exit 1; } - name: Push to Hugging Face Spaces env: HF_TOKEN: ${{ secrets.HF_TOKEN }} HF_USERNAME: ${{ secrets.HF_USERNAME }} HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }} run: | git remote add space https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$HF_SPACE_NAME git push space main --force