From 0aa01d545a87d98eda351af8ff160077bc86d0e3 Mon Sep 17 00:00:00 2001 From: turtleDev Date: Fri, 10 Jul 2026 12:01:26 +0300 Subject: [PATCH] bruin: bump version to 0.5.2 and guard tag/version drift The v0.5.1 release failed to publish. actions/checkout resolves the release tag, but uv build reads the version from pyproject.toml, which was never bumped past 0.5.0. The job rebuilt bruin_sdk-0.5.0 and PyPI rejected the upload: 400 Uploading new files to releases older than 14 days is not allowed 0.5.0 was published four months prior, so the artifact was refused. The tag name never reaches the built distribution. Bump the version to 0.5.2, leaving 0.5.1 unused since its tag already points at a 0.5.0 tree. Add a publish-time check asserting the release tag matches the pyproject version, so a missed bump fails before uv build rather than silently rebuilding a stale version. __version__ in src/bruin/__init__.py had drifted independently to 0.4.0, a second version source that nothing kept in sync. Derive it from installed distribution metadata instead, making pyproject.toml authoritative. --- .github/workflows/publish.yml | 9 +++++++++ pyproject.toml | 2 +- src/bruin/__init__.py | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e75fcf8..b27db29 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,5 +15,14 @@ jobs: steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v5 + - name: Verify tag matches pyproject version + if: github.event_name == 'release' + run: | + tag="${GITHUB_REF_NAME#v}" + pkg="$(uv version --short)" + if [ "$tag" != "$pkg" ]; then + echo "::error::tag v$tag does not match pyproject version $pkg — bump version in pyproject.toml" + exit 1 + fi - run: uv build - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index 8f322c8..a3c0899 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "bruin-sdk" -version = "0.5.0" +version = "0.5.2" description = "Python SDK for Bruin CLI — query databases, parse context, and access connections with zero boilerplate." readme = "README.md" license = "Apache-2.0" diff --git a/src/bruin/__init__.py b/src/bruin/__init__.py index 101525d..776c815 100644 --- a/src/bruin/__init__.py +++ b/src/bruin/__init__.py @@ -1,8 +1,14 @@ """Bruin SDK — zero-boilerplate access to Bruin-managed connections and context.""" +from importlib.metadata import PackageNotFoundError, version + from bruin._connection import get_connection from bruin._context import context from bruin._query import query -__version__ = "0.4.0" +try: + __version__ = version("bruin-sdk") +except PackageNotFoundError: # source tree without an installed distribution + __version__ = "0.0.0.dev0" + __all__ = ["__version__", "context", "get_connection", "query"]