v0.3.6 #15
Workflow file for this run
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: | |
release: | |
types: [published] | |
jobs: | |
# Publish the package to PyPI https://pypi.org | |
pypi-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v1 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Check version correctness | |
run: | | |
python3 .github/check_version.py --tag $GITHUB_REF_NAME --new_version $(< VERSION) --old_version $(git cat-file -p $(git rev-parse "$GITHUB_SHA"^1):VERSION) | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install .[dev] | |
- name: Build and publish to PyPI | |
if: ${{ success() }} # publish only when version passed the checks | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python3 -m build -w | |
twine check dist/* | |
twine upload --repository pypi dist/* |