diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 4a397a2..52740b2 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -26,10 +26,19 @@ jobs: - name: Build a binary wheel and a source tarball run: | - export PYTHON_MOIRA_CLIENT_VERSION=`echo ${GITHUB_REF_NAME} \ + VERSION_TAG=`echo ${GITHUB_REF_NAME} \ | sed -r 's#v([0-9]+\.[0-9]\.[0-9])#\1#g' \ | sed 's#[^a-zA-Z0-9_\.\-]#_#g'` - echo $PYTHON_MOIRA_CLIENT_VERSION + echo "tag version = $VERSION_TAG" + + VERSION_FILE=$(echo 'import version; print(version.VERSION)' | python -) + echo "file version = $VERSION_FILE" + + if [ "$VERSION_TAG" != "$VERSION_FILE" ]; then + echo "Version in file 'version.py' must be the same as the pushed tag" + exit 1 + fi + python -m build --sdist --wheel --outdir dist/ # make this available for test # - name: Publish distribution 📦 to Test PyPI diff --git a/setup.py b/setup.py index b35061c..5c6f230 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,12 @@ from distutils.core import setup -import os +from version import VERSION with open('requirements.txt') as f: required = f.read().splitlines() setup( name='moira-python-client', - version=os.environ['PYTHON_MOIRA_CLIENT_VERSION'], + version=VERSION, description='Client for Moira - Alerting system based on Graphite data', keywords='moira monitoring client metrics alerting', long_description=""" diff --git a/version.py b/version.py new file mode 100644 index 0000000..09c37f6 --- /dev/null +++ b/version.py @@ -0,0 +1 @@ +VERSION='4.1.2' \ No newline at end of file