Merge pull request #5 from PitterPatterPython/dev #4
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: | |
push: | |
tags: | |
- 'v*' # This will trigger the workflow for any tag starting with 'v' | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: poetry install | |
- name: Check version | |
run: | | |
pkg_version=$(poetry version -s) | |
tag_version=${GITHUB_REF#refs/tags/v} | |
if [ "$pkg_version" != "$tag_version" ]; then | |
echo "Version mismatch: pyproject.toml ($pkg_version) != Git tag ($tag_version)" | |
exit 1 | |
fi | |
- name: Build package | |
run: poetry build | |
- name: Publish to PyPI | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_PUBLISH }} | |
run: | | |
poetry config pypi-token.pypi $PYPI_TOKEN | |
poetry publish | |