v0.2.3 #10
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 Python Package | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- created | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Check if tag matches the Poetry version | |
run: | | |
TAG_VERSION=${GITHUB_REF#refs/tags/v} # Strips 'refs/tags/v' leaving just the version number. | |
POETRY_VERSION=$(poetry version --short) | |
echo "Tag version: $TAG_VERSION" | |
echo "Poetry version: $POETRY_VERSION" | |
if [[ "$TAG_VERSION" != "$POETRY_VERSION" ]]; then | |
echo "Error: Tag version ($TAG_VERSION) does not match the version in pyproject.toml ($POETRY_VERSION)" | |
exit 1 | |
fi | |
shell: bash | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'poetry' | |
- name: Cache deps | |
run: poetry install | |
- name: Build | |
run: poetry build | |
- name: Publish to PyPI | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | |
run: poetry publish |