kodaquant-backend / .github /workflows /sync_huggingface.yml
GitHub Actions KodaQuant
deploy: sync automático a Hugging Face Spaces (ZeroGPU, front-matter README corregido)
960fcdd
Raw History Blame Contribute Delete
2.56 kB
name: Despliegue Automático a Hugging Face
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Empujar estado limpio a Hugging Face
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# 1. Crear .gitignore linea por linea sin sangrías
echo "node_modules/" > .gitignore
echo "venv/" >> .gitignore
echo ".env" >> .gitignore
echo "dist/" >> .gitignore
echo "build/" >> .gitignore
echo "__pycache__/" >> .gitignore
echo "*.pyc" >> .gitignore
echo ".DS_Store" >> .gitignore
# 2. Inyectar la llave de encendido de Gradio con Python 3.12
# FIX -- `sdk_version`/`python_version` DEBEN ir entre comillas.
# Verificado: `echo "python_version: 3.12" >> README.md` (sin
# comillas) produce un YAML donde ese valor se parsea como FLOAT
# (3.12), no como string "3.12" -- el mismo tipo de
# "configuration error" silencioso que ya rompió el build por el
# pin de torch. El template oficial de HF (`{{sdkVersion}}` /
# `{{pythonVersion}}`) siempre los entrega entre comillas dobles
# por esta razón exacta.
echo "---" > README.md
echo "title: KodaQuant Backend" >> README.md
echo "emoji: 🚀" >> README.md
echo "colorFrom: blue" >> README.md
echo "colorTo: indigo" >> README.md
echo "sdk: gradio" >> README.md
echo 'sdk_version: "6.22.0"' >> README.md
echo 'python_version: "3.12"' >> README.md
echo "app_file: app.py" >> README.md
echo "pinned: false" >> README.md
echo "---" >> README.md
# 3. Borrar el historial fantasma de Git
rm -rf .git
git init
git checkout -b main
git config user.name "GitHub Actions KodaQuant"
git config user.email "actions@github.com"
# 4. Rastrear solo los archivos que existen HOY
git lfs install
git lfs track "*.keras"
git lfs track "*.pkl"
git add .
# 5. Empaquetar y forzar la subida a Hugging Face
git commit -m "deploy: sync automático a Hugging Face Spaces (ZeroGPU, front-matter README corregido)"
git push --force https://Zusheim:$HF_TOKEN@huggingface.co/spaces/Zusheim/kodaquant-backend main