#!/bin/bash PROJECT_ROOT=$(git rev-parse --show-toplevel) VERSION=$(grep 'version =' $PROJECT_ROOT/pyproject.toml | head -1 | cut -d '"' -f 2) INIT_FILE="$PROJECT_ROOT/dotgift/dotgift/__init__.py" # Portable workaround for macOS/Linux sed differences sed -i.bak "s/__version__ = .*/__version__ = \"$VERSION\"/" $INIT_FILE && \ rm "$INIT_FILE.bak"