Skip to content

Commit 1a27a40

Browse files
authored
Merge pull request #208 from AgentOps-AI/version-check-action
move version check
2 parents 50ebd02 + bccc9a1 commit 1a27a40

File tree

2 files changed

+32
-51
lines changed

2 files changed

+32
-51
lines changed

.github/workflows/deploy.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,38 @@ jobs:
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 }}

.github/workflows/version-check-on-release.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)