Skip to content

🔖 Add proper version tags (#11) #4

🔖 Add proper version tags (#11)

🔖 Add proper version tags (#11) #4

Workflow file for this run

name: Publish python package
on:
push:
tags:
- "v*.*.*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Validate version
id: validate_version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
PYPROJECT_VERSION=$(poetry version -s)
echo "Tag version: $TAG_VERSION"
echo "Pyproject version: $PYPROJECT_VERSION"
if [ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]; then
echo "Error: Tag version ($TAG_VERSION) does not match pyproject.toml version ($PYPROJECT_VERSION)."
exit 1
fi
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}