Merge pull request #91 from PolyPhyHub/cli-fix #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Check if Python package already exists | |
run: | | |
pip install PolyPhyPy==$(cat pyproject.toml | head -3 | tail -1 | cut -d '"' -f 2) && echo "true" > ./flag || echo "false" > ./flag | |
- name: Build and publish package | |
env: | |
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
run: | | |
if grep -qF false ./flag; then | |
python3 -m pip install --upgrade build | |
python3 -m build | |
python3 -m pip install --upgrade twine | |
python3 -m twine upload dist/* | |
echo "New version is live!!!" | |
else | |
echo "Not publishing as the above version already exists!" | |
fi |