add better unit tests (#6) #12
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: PyPI Release | |
on: | |
push: | |
paths: | |
- 'patchmatch/__init__.py' | |
workflow_dispatch: | |
jobs: | |
release: | |
if: github.repository == 'mauwii/PyPatchMatch' | |
runs-on: ubuntu-22.04 | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
TWINE_NON_INTERACTIVE: 1 | |
steps: | |
- name: checkout sources | |
uses: actions/checkout@v3 | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: install deps | |
run: pip install --upgrade ".[dist]" | |
- name: build package | |
run: python3 -m build | |
- name: check distribution | |
if: github.ref == 'refs/heads/main' | |
run: twine check dist/* | |
- name: check PyPI versions | |
if: github.ref == 'refs/heads/main' | |
run: | | |
python -c "\ | |
import scripts.pypi_helper; \ | |
EXISTS=scripts.pypi_helper.local_on_pypi(); \ | |
print(f'PACKAGE_EXISTS={EXISTS}')" >> $GITHUB_ENV | |
- name: upload package | |
if: env.PACKAGE_EXISTS == 'False' && env.TWINE_PASSWORD != '' | |
run: twine upload dist/* |