diff --git a/.github/scripts/bump_version.py b/.github/scripts/bump_version.py index 96a037c..f3fd968 100644 --- a/.github/scripts/bump_version.py +++ b/.github/scripts/bump_version.py @@ -38,7 +38,9 @@ def main() -> None: if new_parsed <= current_parsed: sys.exit(f"Error: {new} does not exceed the current version {current}.") subprocess.run(["uv", "version", new, "--no-sync"], check=True) - VERSION_FILE.write_text(f'__version__ = "{new}"\n') + VERSION_FILE.write_text( + re.sub(r'(?m)^__version__ = ".*"$', f'__version__ = "{new}"', VERSION_FILE.read_text()) + ) if __name__ == "__main__": diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index d279b46..004c7ce 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -49,7 +49,7 @@ jobs: - name: Bump package version run: | new="$(uv version --bump patch --bump dev=0 --short --no-sync)" - printf '__version__ = "%s"\n' "$new" > src/gimmegit/_version.py + sed -i "s/^__version__ = \".*\"/__version__ = \"$new\"/" src/gimmegit/_version.py - name: Open a PR env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}