github-actions
Auto deploy from GitHub Actions
1914b78
name: SQL CI pipeline
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4 # ✅ FIX
- name: Setup Python
uses: actions/setup-python@v5 # ✅ FIX
with:
python-version: "3.10"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install flake8 pytest
- name: Lint check
run: flake8 . || true
- name: Run tests
run: pytest src/tests/ || true
- name: Deploy to Hugging Face Spaces
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_USERNAME: ${{ secrets.HF_USERNAME }}
HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }}
run: |
git config --global user.email "actions@github.com"
git config --global user.name "github-actions"
git clone https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$HF_SPACE_NAME space-repo
rsync -av --exclude='.git' ./ space-repo/
cd space-repo
git add .
git commit -m "Auto deploy from GitHub Actions" || echo "No changes"
git push