Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,34 @@ jobs:
GIT_TAG: ${{ github.ref_name }}
run: |
tag="${GIT_TAG#v}"
project=$(python -c "import pathlib,tomllib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text(encoding='utf-8'))['project']['version'])")
echo "tag=$tag pyproject=$project"
if [ "$tag" != "$project" ]; then
echo "::error::tag $tag does not match the pyproject version $project" >&2
exit 1
fi
echo "INTENTUMDIFF_EXPECTED_VERSION=$tag" >> "$GITHUB_ENV"
# Compare NORMALISED versions, not strings. Every IntentumDiff component is tagged
# with one estate-wide string (v0.0.2-beta.1) so the release does not look like
# several different releases, but PEP 440's canonical spelling is 0.0.2b1 and that is
# what pyproject and the wheel filename must carry. They are the SAME version β€”
# Version("0.0.2-beta.1") == Version("0.0.2b1") β€” and a string compare would reject a
# perfectly correct pairing.
#
# This still fails closed on a real mismatch: 0.0.3 vs 0.0.2 does not normalise away.
python - "$tag" <<'PY'
import pathlib, sys, tomllib
from packaging.version import InvalidVersion, Version

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install packaging before importing it

On a clean actions/setup-python Python 3.12 installation where only the standard bootstrap packages are present, packaging is not importable, and this tag-only step runs before any dependency-installation step. Consequently all four release matrix legs can stop with ModuleNotFoundError before normalization occurs; install a pinned packaging dependency before this step or perform the comparison without an undeclared third-party module.

Useful? React with πŸ‘Β / πŸ‘Ž.


tag_raw = sys.argv[1]
project_raw = tomllib.loads(
pathlib.Path("pyproject.toml").read_text(encoding="utf-8")
)["project"]["version"]
try:
tag, project = Version(tag_raw), Version(project_raw)
except InvalidVersion as exc:
sys.exit(f"::error::version is not PEP 440 parseable: {exc}")
print(f"tag={tag_raw} ({tag}) pyproject={project_raw} ({project})")
if tag != project:
sys.exit(
f"::error::tag {tag_raw} normalises to {tag}, which does not match the "
f"pyproject version {project_raw} ({project})"
)
PY
echo "INTENTUMDIFF_EXPECTED_VERSION=$(python -c "from packaging.version import Version; print(Version('$tag'))")" >> "$GITHUB_ENV"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Normalize the version again in the publish job

For the intended prerelease tag v0.0.2-beta.1, this exports 0.0.2b1 only within each build-wheels job; GITHUB_ENV does not propagate across jobs. The publish job later sets INTENTUMDIFF_EXPECTED_VERSION back to the raw 0.0.2-beta.1 at line 281, while verify_intentumdiff_wheel.py compares that string exactly with the wheel filename's 0.0.2b1, so every wheel can build successfully but the final PyPI verification still rejects the release. Normalize the tag in the publish job as well.

Useful? React with πŸ‘Β / πŸ‘Ž.


- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
Expand Down
Loading