Skip to content

Commit a59a1ca

Browse files
authored
Merge pull request #127 from retentioneering/ci/release-version-guard
Bump version to 5.2.0 and guard the tag/pyproject mismatch
2 parents 292e39b + 26bf173 commit a59a1ca

4 files changed

Lines changed: 25 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ jobs:
4545
- name: Build sdist and wheel
4646
run: uv build
4747

48+
# The build takes its version from pyproject.toml, not from the tag
49+
# (ADR-0011: no dynamic versioning), so a tag pushed ahead of the version
50+
# bump would silently rebuild the previous release. Catch that here
51+
# rather than at `uv publish`, which fails with an opaque "File already
52+
# exists" from PyPI. Assumes the tag is already a PEP 440-normalized
53+
# version (`v5.2.0`, `v5.2.0rc1` -- not `v5.2.0-rc1`).
54+
- name: Verify the built version matches the tag
55+
run: |
56+
set -e
57+
VERSION="${GITHUB_REF_NAME#v}"
58+
if [ ! -f "dist/retentioneering-${VERSION}-py3-none-any.whl" ]; then
59+
echo "::error::Tag ${GITHUB_REF_NAME} doesn't match pyproject.toml's version -- built $(ls dist/*.whl). Bump pyproject.toml to ${VERSION}, then re-tag."
60+
exit 1
61+
fi
62+
4863
- name: Verify the wheel embeds the JS bundle
4964
run: |
5065
set -e

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ release:
6363
"rename '## [Unreleased]' to '## [$(VERSION)] - $$(date +%Y-%m-%d)' (and add a fresh" \
6464
"empty '## [Unreleased]' above it), then land that on master before releasing."; exit 1; \
6565
fi
66+
@# release.yml builds whatever pyproject.toml says, not what the tag says
67+
@# (ADR-0011: no dynamic versioning). Without this check a tag pushed
68+
@# ahead of the version bump republishes the *previous* version and the
69+
@# run dies on PyPI's "File already exists".
70+
@if ! grep -q '^version = "$(VERSION)"$$' pyproject.toml; then \
71+
echo "pyproject.toml says $$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2), not $(VERSION)" \
72+
"-- bump it in the version-bump PR and land that on master before releasing."; exit 1; \
73+
fi
6674
git tag -a v$(VERSION) -m "Release v$(VERSION)"
6775
git push origin v$(VERSION)
6876
@echo "✓ Pushed tag v$(VERSION) -- release.yml will build and publish to PyPI."

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "retentioneering"
7-
version = "5.1.0"
7+
version = "5.2.0"
88
authors = [
99
{ name = "Retentioneering User Trajectory Analysis Lab", email = "retentioneering@gmail.com" },
1010
]

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)