|
name: Release |
|
|
|
on: |
|
push: |
|
tags: ["v[0-9]+.[0-9]+.[0-9]+"] |
|
branches: ["*"] |
|
|
|
jobs: |
|
pypi_deploy: |
|
name: Deploy to PyPI |
|
runs-on: ubuntu-latest |
|
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }} |
|
steps: |
|
- name: Check out code |
|
uses: actions/checkout@v3 |
|
with: |
|
ref: ${{ github.head_ref }} |
|
fetch-depth: 0 |
|
|
|
- name: Set up Python |
|
uses: actions/setup-python@v2 |
|
with: |
|
python-version: '3.8' |
|
|
|
- name: Install dependencies |
|
run: | |
|
python -m pip install --upgrade pip |
|
pip install -r requirements.txt |
|
pip install build |
|
pip install twine |
|
|
|
- name: Build Package |
|
run: | |
|
python -m build |
|
|
|
- name: Check Package |
|
run: | |
|
twine check dist/* --strict |
|
|
|
- name: Publish to PyPI |
|
env: |
|
TWINE_USERNAME: __token__ |
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
|
run: | |
|
twine upload dist/* --verbose |
|
|
|
huggingface_deploy: |
|
name: Deploy to Hugging Face |
|
runs-on: ubuntu-latest |
|
needs: pypi_deploy |
|
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }} |
|
steps: |
|
- name: Check out code |
|
uses: actions/checkout@v3 |
|
with: |
|
ref: ${{ github.head_ref }} |
|
fetch-depth: 0 |
|
|
|
- name: Setup Git Config |
|
run: | |
|
git checkout main |
|
git config --global user.email "[email protected]" |
|
git config --global user.name "Hasan Iqbal" |
|
|
|
- name: Enable HuggingFace Spaces Config |
|
run: | |
|
READMEFILE="README.md" |
|
sed -i 's/<!--/---/g; s/-->/---/g' $READMEFILE |
|
git add $READMEFILE |
|
git commit -m "Uncommented HuggingFace Spaces Configuration" || echo "No changes to commit" |
|
|
|
- name: Wait for 10 seconds |
|
run: sleep 10 |
|
|
|
- name: Push to Hugging Face |
|
env: |
|
HF_TOKEN: ${{ secrets.HF_TOKEN }} |
|
run: git push https://hasaniqbal777:[email protected]/spaces/hasaniqbal777/OpenFactCheck main --force |
|
|