#!/usr/bin/env bash # retoor set -euo pipefail if git rev-parse -q --verify MERGE_HEAD >/dev/null; then exit 0 fi if git diff --cached -U0 -- pyproject.toml | grep -q '^+version = '; then exit 0 fi python3 - <<'PY' import re from pathlib import Path path = Path("pyproject.toml") text = path.read_text(encoding="utf-8") match = re.search(r'^version = "(\d+)\.(\d+)\.(\d+)"', text, re.M) if match: major, minor, patch = map(int, match.groups()) text = text.replace(match.group(0), f'version = "{major}.{minor}.{patch + 1}"', 1) path.write_text(text, encoding="utf-8") PY git add pyproject.toml