Skip to content

Commit 16985b8

Browse files
authored
Merge pull request BrkRaw#190 from BrkRaw/revert-189-main
Revert "Fix publish version check script"
2 parents 8bb3d40 + 6987529 commit 16985b8

1 file changed

Lines changed: 2 additions & 29 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,8 @@ jobs:
3030
if: ${{ github.event_name == 'release' }}
3131
run: |
3232
tag="${{ github.ref_name }}"
33-
version="$(python - <<'PY'
34-
from pathlib import Path
35-
import re
36-
import tomllib
37-
38-
pyproject = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
39-
version = None
40-
if "project" in pyproject:
41-
version = pyproject["project"].get("version")
42-
43-
if not version:
44-
version_path = (
45-
pyproject.get("tool", {})
46-
.get("hatch", {})
47-
.get("version", {})
48-
.get("path")
49-
)
50-
if not version_path:
51-
raise SystemExit("No version in pyproject.toml and no hatch version path found.")
52-
text = Path(version_path).read_text(encoding="utf-8")
53-
match = re.search(r"__version__\\s*=\\s*['\\\"]([^'\\\"]+)['\\\"]", text)
54-
if not match:
55-
raise SystemExit(f"No __version__ found in {version_path}")
56-
version = match.group(1)
57-
58-
print(version)
59-
PY
60-
)"
61-
if [ "${tag}" != "${version}" ] && [ "${tag}" != "v${version}" ]; then
33+
version="$(python - <<'PY'\nfrom pathlib import Path\nimport re\nimport tomllib\n\npyproject = tomllib.loads(Path('pyproject.toml').read_text(encoding='utf-8'))\nversion = None\nif 'project' in pyproject:\n version = pyproject['project'].get('version')\n\nif not version:\n version_path = (\n pyproject.get('tool', {})\n .get('hatch', {})\n .get('version', {})\n .get('path')\n )\n if not version_path:\n raise SystemExit('No version in pyproject.toml and no hatch version path found.')\n text = Path(version_path).read_text(encoding='utf-8')\n match = re.search(r\"__version__\\s*=\\s*['\\\"]([^'\\\"]+)['\\\"]\", text)\n if not match:\n raise SystemExit(f'No __version__ found in {version_path}')\n version = match.group(1)\n\nprint(version)\nPY\n)"
34+
if [ "v${version}" != "${tag}" ]; then
6235
echo "Tag ${tag} does not match package version ${version}."
6336
exit 1
6437
fi

0 commit comments

Comments
 (0)