skhavin's picture
deploy: add Gradio app, requirements.txt, and GitHub publish actions CI/CD
d52bbcf
Raw
History Blame Contribute Delete
1.44 kB
name: Publish to PyPI and Hugging Face
on:
push:
tags:
- 'v*'
jobs:
test:
runs-on: ubuntu-latest
steps:
- 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 .[dev]
- name: Run Pytest
run: pytest
publish-pypi:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install build tools
run: pip install build twine
- name: Build binary wheel and source tarball
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
sync-to-huggingface:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to HuggingFace Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git remote add hf https://huggingface.co/spaces/skhavin/proactive-cache
git push https://skhavin:$HF_TOKEN@huggingface.co/spaces/skhavin/proactive-cache master:main --force