You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/publish-to-pypi.yml
+38-5Lines changed: 38 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -67,11 +67,44 @@ jobs:
67
67
exit 1
68
68
fi
69
69
70
-
PYPROJECT_VERSION=$(python -c 'import pathlib, tomllib; data = tomllib.loads(pathlib.Path("pyproject.toml").read_text()); print(data["project"]["version"])')
71
-
72
-
INIT_VERSION=$(python -c 'import pathlib, re, sys; text = pathlib.Path("src/code_index_mcp/__init__.py").read_text(); match = re.search(r"__version__\s*=\s*\"([^\"]+)\"", text); sys.exit("Could not read __version__ from src/code_index_mcp/__init__.py") if not match else print(match.group(1))')
73
-
74
-
LOCK_VERSION=$(python -c 'import pathlib, tomllib, sys; data = tomllib.loads(pathlib.Path("uv.lock").read_text()); print(next((pkg["version"] for pkg in data["package"] if pkg["name"] == "code-index-mcp"), None) or sys.exit("Could not find code-index-mcp in uv.lock"))')
70
+
PYPROJECT_VERSION=$(python - <<'PY'
71
+
import pathlib, re
72
+
73
+
text = pathlib.Path("pyproject.toml").read_text()
74
+
match = re.search(r'^version\s*=\s*"([^"]+)"', text, re.MULTILINE)
75
+
if not match:
76
+
raise SystemExit("Could not read version from pyproject.toml")
77
+
print(match.group(1))
78
+
PY
79
+
)
80
+
81
+
INIT_VERSION=$(python - <<'PY'
82
+
import pathlib, re
83
+
84
+
text = pathlib.Path("src/code_index_mcp/__init__.py").read_text()
85
+
match = re.search(r'__version__\s*=\s*"([^"]+)"', text)
86
+
if not match:
87
+
raise SystemExit("Could not read __version__ from src/code_index_mcp/__init__.py")
88
+
print(match.group(1))
89
+
PY
90
+
)
91
+
92
+
LOCK_VERSION=$(python - <<'PY'
93
+
version = None
94
+
with open("uv.lock", "r", encoding="utf-8") as fh:
95
+
lines = fh.readlines()
96
+
for idx, line in enumerate(lines):
97
+
if line.strip() == 'name = "code-index-mcp"':
98
+
for follower in lines[idx:idx+6]:
99
+
if follower.strip().startswith("version ="):
100
+
version = follower.split("=", 1)[1].strip().strip('"')
101
+
break
102
+
break
103
+
if version is None:
104
+
raise SystemExit("Could not find code-index-mcp in uv.lock")
105
+
print(version)
106
+
PY
107
+
)
75
108
76
109
for entry in "pyproject.toml:$PYPROJECT_VERSION" "src/code_index_mcp/__init__.py:$INIT_VERSION" "uv.lock:$LOCK_VERSION"; do
0 commit comments