name: CI/CD on: push: branches: [main] jobs: quality-assurance: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.9' cache: 'pip' # Speeds up subsequent runs - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Run CI Suite run: make check deploy-to-hf: needs: quality-assurance # CRITICAL: Only runs if 'test' passes runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true # Enable if you are using large files - name: Push to Hugging Face Hub env: HF_TOKEN: ${{ secrets.HF_TOKEN }} # Replace with your HF username and Space name HF_USERNAME: "anirudh0410" SPACE_NAME: "Prostate-Inference" run: | # Create a temporary file with the metadata echo "---" > hf_header.txt echo "title: Prostate Inference" >> hf_header.txt echo "emoji: 🚀" >> hf_header.txt echo "colorFrom: blue" >> hf_header.txt echo "colorTo: red" >> hf_header.txt echo "sdk: docker" >> hf_header.txt echo "pinned: false" >> hf_header.txt echo "short_description: Predicts csPCa risk and PI-RADS score from bpMRI sequences" >> hf_header.txt echo "app_port: 8501" >> hf_header.txt echo "---" >> hf_header.txt # Combine metadata with the real README cat hf_header.txt README.md > README_new.md mv README_new.md README.md git config --global user.email "action@github.com" git config --global user.name "GitHub Action" git add README.md git commit -m "Add HF metadata for deployment" # Add Hugging Face as a remote git remote add space https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME # Force push to the Space git push --force space HEAD:main