diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 459dae36..e75bf62c 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -34,7 +34,7 @@ jobs: run: tox - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml diff --git a/.github/workflows/version-check-on-release.yml b/.github/workflows/version-check-on-release.yml new file mode 100644 index 00000000..e952175d --- /dev/null +++ b/.github/workflows/version-check-on-release.yml @@ -0,0 +1,51 @@ +name: Verify Package Version + +on: + release: + types: [created] + +jobs: + verify-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install toml package + run: pip install toml + + - name: Check version matches + run: | + import toml + import os + import sys + + # Read pyproject.toml + with open('pyproject.toml', 'r') as f: + pyproject = toml.load(f) + + # Get version from pyproject.toml + project_version = pyproject['project']['version'] + + # Get release tag (strip 'v' prefix if present) + github_ref = os.environ['GITHUB_REF'] + tag_version = github_ref.split('/')[-1] + if tag_version.startswith('v'): + tag_version = tag_version[1:] + + print(f"pyproject.toml version: {project_version}") + print(f"Release tag version: {tag_version}") + + # Compare versions + if project_version != tag_version: + print("Version mismatch!") + print(f"pyproject.toml version ({project_version}) does not match") + print(f"release tag version ({tag_version})") + sys.exit(1) + + print("Versions match!") + shell: python \ No newline at end of file