Skip to content

Commit

Permalink
Merge pull request #5 from PitterPatterPython/dev
Browse files Browse the repository at this point in the history
added version checking, and will fail if the version in the pyproject…
  • Loading branch information
robd518 authored Jul 1, 2024
2 parents 1e766b9 + 3042978 commit dcfa7e3
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Publish to PyPI

on:
push:
branches:
- main
tags:
- 'v*' # This will trigger the workflow for any tag starting with 'v'

jobs:
build-and-publish:
Expand All @@ -24,6 +24,15 @@ jobs:
- 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

Expand All @@ -32,4 +41,8 @@ jobs:
PYPI_TOKEN: ${{ secrets.PYPI_PUBLISH }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish
poetry publish

0 comments on commit dcfa7e3

Please sign in to comment.