AQI_Predictor_Qamar / .github /workflows /deploy_to_hf.yml
github-actions[bot]
Automated backend deployment for 2026-04-06
cfd22e2
# This updates the hf backend
name: Deploy Backend to Hugging Face
on:
workflow_dispatch:
schedule:
# Runs at 2 am karachi time
- cron: '0 21 * * *'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# We don't need the full history, just the latest code
with:
lfs: true
#tells the checkout to handle your LFS model file, LFS is a github shipping service which handles large model files
- name: Create Clean Deployment Branch
run: |
# This sequence creates a single, clean commit
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout --orphan deploy-branch
rm -f "AQI Predictor Report Final.pdf"
git add -A
git commit -m "Automated backend deployment for $(date +%F)"
- name: Push to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# This is the same push command from your script
git remote add space "https://Qar-Raz:${HF_TOKEN}@huggingface.co/spaces/Qar-Raz/AQI_Predictor_Qamar"
git push --force space deploy-branch:main