From 49780603de7fd94a3f3f4cffa52d0743a0c84651 Mon Sep 17 00:00:00 2001 From: Callmeiks Date: Sun, 12 Apr 2026 16:46:08 -0700 Subject: [PATCH] fix: read version from file instead of importing module in release workflow The version check ran before pip install, so the import failed. Read _version.py directly with regex instead. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4875fa1..d50c67d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,11 @@ jobs: - name: Verify version matches tag run: | TAG="${GITHUB_REF#refs/tags/v}" - PKG_VERSION=$(python -c "from src.tikhub._version import __version__; print(__version__)") + PKG_VERSION=$(python -c " +import re, pathlib +text = pathlib.Path('src/tikhub/_version.py').read_text() +print(re.search(r'__version__\s*=\s*[\"'\''](.*?)[\"'\'']', text).group(1)) +") if [ "$TAG" != "$PKG_VERSION" ]; then echo "::error::tag $TAG does not match package version $PKG_VERSION" exit 1