From 8a85af5f91e4cad64ec925675a0266a9df126342 Mon Sep 17 00:00:00 2001 From: "Patrick M. Niedzielski" Date: Mon, 9 Nov 2026 15:49:38 -0500 Subject: [PATCH] CI: Add an initial workflow to prepare a release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a workflow that will eventually fully automate the process of making a new release of the BlazingMQ Python SDK. The ultimate vision is this: making a release will involve going to the Actions tab on GitHub, clicking the “Prepare Release” button and selecting the new version and the branch to release. This will create a PR that bumps the version number in the source code and runs towncrier to generate the release notes. Someone reviews the PR and merges it, which creates a tag, a GitHub release, and pushes a new version to PyPI. The workflow in this commit is just a skeleton workflow, which adds the button, does some minimal version string verification, and prints the diff it would generate with the version bump and with towncrier release notes. It only does this as a dry run, and does not generate the PR. Signed-off-by: Patrick M. Niedzielski --- .../{build_wheels.yml => build_wheels.yaml} | 0 .github/workflows/prepare-release.yml | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+) rename .github/workflows/{build_wheels.yml => build_wheels.yaml} (100%) create mode 100644 .github/workflows/prepare-release.yml diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yaml similarity index 100% rename from .github/workflows/build_wheels.yml rename to .github/workflows/build_wheels.yaml diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 0000000..042844e --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,54 @@ +name: Prepare release + +on: + workflow_dispatch: + inputs: + version: + description: New version (for example, 1.2.4) + type: string + required: true + +permissions: + contents: read + +jobs: + prepare: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: main + persist-credentials: false + + - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 + with: + python-version: '3.14' + + - name: Update version + env: + VERSION: ${{ inputs.version }} + run: | + uv run --no-project --with packaging python - <<'PY' + import os + import re + from pathlib import Path + from packaging.version import Version + + path = Path("src/blazingmq/_about.py") + contents = path.read_text() + current = re.search(r'^__version__ = "([^"]+)"$', contents, re.MULTILINE).group(1) + version = os.environ["VERSION"] + if str(Version(version)) != version or Version(version) <= Version(current): + raise SystemExit(f"Use a canonical Python version greater than {current}") + path.write_text(contents.replace( + f'__version__ = "{current}"', f'__version__ = "{version}"' + )) + PY + + - name: Build release notes + env: + VERSION: ${{ inputs.version }} + run: uvx towncrier build --name blazingmq --version "$VERSION" --yes + + - name: Show release changes + run: git --no-pager diff HEAD