From 53a08c0f76f3e64cc0edf619b69f93107b399ec4 Mon Sep 17 00:00:00 2001 From: laubonghaudoi Date: Sun, 9 Jun 2024 10:53:37 -0700 Subject: [PATCH] Fix CI workflow Fix CI workflow for automatic PyPI publishing --- .github/workflows/publish-to-pypi.yml | 4 ++++ cantofilter/version.py | 2 +- setup.py | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 5d8aeec..eec85bd 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -20,6 +20,10 @@ jobs: - name: Run tests run: | python -m unittest tests/test_judge.py + - name: Update version in setup.py + run: | + version=$(python -c "exec(open('cantofilter/version.py').read()); print(__version__)") + sed -i "s/version=.*/version='$version',/" setup.py - name: Build and publish env: TWINE_USERNAME: __token__ diff --git a/cantofilter/version.py b/cantofilter/version.py index 92192ee..6849410 100644 --- a/cantofilter/version.py +++ b/cantofilter/version.py @@ -1 +1 @@ -__version__ = "1.0.4" +__version__ = "1.1.0" diff --git a/setup.py b/setup.py index a4c2176..e550324 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,8 @@ from setuptools import setup, find_packages -from cantofilter import __version__ +# Read the version from cantofilter/version.py +version = {} +with open("cantofilter/version.py") as fp: + exec(fp.read(), version) # Read the contents of your README file with open("README.md", "r", encoding="utf-8") as fh: @@ -7,7 +10,7 @@ setup( name="canto-filter", - version=__version__, + version=version['__version__'], author="CanCLID (Cantonese Computational Linguistics Infrastructure Development Workgroup)", author_email="support@jyutping.org", description="粵文分類篩選器 Cantonese text filter",