Skip to content

Commit 4046782

Browse files
committed
Add validation step to ensure release tag matches project version
1 parent 132a598 commit 4046782

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.github/workflows/python-publish.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@ jobs:
1818
with:
1919
python-version: "3.x"
2020

21+
- name: Validate release tag matches version
22+
run: |
23+
# Extract version from pyproject.toml
24+
PROJECT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
25+
# Extract tag from GitHub ref
26+
RELEASE_TAG=${GITHUB_REF#refs/tags/}
27+
28+
echo "Project version: $PROJECT_VERSION"
29+
echo "Release tag: $RELEASE_TAG"
30+
31+
if [ "$PROJECT_VERSION" != "$RELEASE_TAG" ]; then
32+
echo "Error: Release tag ($RELEASE_TAG) does not match project version ($PROJECT_VERSION)"
33+
exit 1
34+
fi
35+
36+
echo "Release tag matches project version ✓"
37+
2138
- name: Build release distributions
2239
run: |
2340
# NOTE: put your own distribution build steps here.

0 commit comments

Comments
 (0)