omnibin / .github /workflows /update-hf-space.yml
felipekitamura's picture
Automated update from GitHub
ef88f19
name: Deploy to Hugging Face Space
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout source repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Run tests
run: pytest tests/
deploy:
runs-on: ubuntu-latest
needs: test # 👈 only runs if 'test' job passes
steps:
- name: Checkout source repo
uses: actions/checkout@v3
- name: Clone HF Space repo
run: |
git config --global user.email "kitamura.felipe@gmail.com"
git config --global user.name "kitamura-felipe"
git clone https://huggingface.co/spaces/felipekitamura/omnibin space
rsync -av --exclude='.git' ./ space/
echo '---' > temp_readme.md
echo 'title: Omnibin' >> temp_readme.md
echo 'emoji: ⚡' >> temp_readme.md
echo 'colorFrom: pink' >> temp_readme.md
echo 'colorTo: yellow' >> temp_readme.md
echo 'sdk: gradio' >> temp_readme.md
echo 'sdk_version: 5.29.0' >> temp_readme.md
echo 'app_file: app.py' >> temp_readme.md
echo 'pinned: false' >> temp_readme.md
echo 'license: mit' >> temp_readme.md
echo 'short_description: A Python package for generating comprehensive binary classi' >> temp_readme.md
echo '---' >> temp_readme.md
echo '' >> temp_readme.md
cat README.md >> temp_readme.md
mv temp_readme.md space/README.md
cd space
git add .
git commit -m "Automated update from GitHub" || echo "No changes"
git push https://USER:$HF_TOKEN@huggingface.co/spaces/felipekitamura/omnibin HEAD:main
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}