File tree Expand file tree Collapse file tree 2 files changed +32
-51
lines changed Expand file tree Collapse file tree 2 files changed +32
-51
lines changed Original file line number Diff line number Diff line change 2323 - name : Build the package
2424 run : python -m build
2525
26+ - name : Check version matches
27+ run : |
28+ import toml
29+ import os
30+ import sys
31+
32+ # Read pyproject.toml
33+ with open('pyproject.toml', 'r') as f:
34+ pyproject = toml.load(f)
35+
36+ # Get version from pyproject.toml
37+ project_version = pyproject['project']['version']
38+
39+ # Get release tag (strip 'v' prefix if present)
40+ github_ref = os.environ['GITHUB_REF']
41+ tag_version = github_ref.split('/')[-1]
42+ if tag_version.startswith('v'):
43+ tag_version = tag_version[1:]
44+
45+ print(f"pyproject.toml version: {project_version}")
46+ print(f"Release tag version: {tag_version}")
47+
48+ # Compare versions
49+ if project_version != tag_version:
50+ print("Version mismatch!")
51+ print(f"pyproject.toml version ({project_version}) does not match")
52+ print(f"release tag version ({tag_version})")
53+ sys.exit(1)
54+
55+ print("Versions match!")
56+ shell : python
57+
2658 - name : Upload to PyPI
2759 env :
2860 TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments