GitHub Actions
🚀 Auto-deploy from GitHub Actions
c03139d
name: Deploiement vers Hugging Face Spaces
on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Préparer les données et le modèle
run: python main.py
- name: Deploy to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git clone https://huggingface.co/spaces/stephmnt/projet_05 hf_space
rsync -av --exclude '.git' --exclude 'docs' ./ hf_space/
cd hf_space
git add .
git commit -m "🚀 Auto-deploy from GitHub Actions" || echo "No changes to commit"
git push https://stephmnt:$HF_TOKEN@huggingface.co/spaces/stephmnt/projet_05 main