Skip to content

fix: lint driven fix #6

fix: lint driven fix

fix: lint driven fix #6

Workflow file for this run

name: Publish
on:
workflow_dispatch:
push:
tags: ["v*"]
jobs:
publish-package:
name: Publish Package
environment: protected
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.11"
- name: Install Poetry
uses: abatilo/actions-poetry@e78f54a89cb052fff327414dd9ff010b5d2b4dbd
with:
poetry-version: "1.8.4"
- name: Configure Poetry
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Install package
run: poetry install --no-dev
- name: Validate version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
POETRY_VERSION=$(poetry version -s)
INIT_VERSION=$(python -c "import dyana; print(dyana.__version__)")
if ! [[ $TAG_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid tag format: $TAG_VERSION. Must be vX.X.X"
exit 1
fi
if [ "$POETRY_VERSION" != "$INIT_VERSION" ]; then
echo "Version mismatch: pyproject.toml ($POETRY_VERSION) != __init__.py ($INIT_VERSION)"
exit 1
fi
if [ "$TAG_VERSION" != "$POETRY_VERSION" ]; then
echo "Tag ($TAG_VERSION) doesn't match pyproject.toml ($POETRY_VERSION)"
exit 1
fi
- name: Build package
run: |
poetry build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc