diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c14494..472f6f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,18 +33,6 @@ jobs: python -m pip install --upgrade pip pip install build twine wheel packaging - - name: Get current version - id: current_version - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - run: | - python -c " - import re - with open('agentx/version.py', 'r') as f: - content = f.read() - current_version = re.search(r'VERSION = \"([^\"]+)\"', content).group(1) - print(f'current_version={current_version}') - " >> $GITHUB_OUTPUT - - name: Bump version (only on main branch pushes) id: bump if: github.ref == 'refs/heads/main' && github.event_name == 'push' @@ -61,115 +49,51 @@ jobs: with open('agentx/version.py', 'w') as f: f.write(new_content) print(f'Bumped version from {current_version} to {new_version}') + " + + - name: Get new version + id: version + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + run: | + python -c " + import re + with open('agentx/version.py', 'r') as f: + content = f.read() + new_version = re.search(r'VERSION = \"([^\"]+)\"', content).group(1) print(f'new_version={new_version}') - " | tee /tmp/version_output.txt - grep 'new_version=' /tmp/version_output.txt >> $GITHUB_OUTPUT + " >> $GITHUB_OUTPUT - - name: Commit and push version bump + - name: Commit version bump if: github.ref == 'refs/heads/main' && github.event_name == 'push' run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add agentx/version.py - git commit -m "Bump version to ${{ steps.bump.outputs.new_version }} [skip ci]" - git push origin main + git commit -m "Bump version to ${{ steps.version.outputs.new_version }} [skip ci]" + git push - - name: Wait for version bump to be available + - name: Wait for version bump commit and fetch latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' run: | - echo "Waiting for version bump commit to be available..." - sleep 30 # Increased wait time to ensure GitHub processes the push - - # Verify the version bump was successful by checking out fresh + sleep 15 # Wait for the version bump commit to be processed git fetch origin main git checkout main git pull origin main - # Verify the version was actually bumped - python -c " - import re - with open('agentx/version.py', 'r') as f: - content = f.read() - actual_version = re.search(r'VERSION = \"([^\"]+)\"', content).group(1) - expected_version = '${{ steps.bump.outputs.new_version }}' - if actual_version != expected_version: - print(f'ERROR: Version mismatch! Expected {expected_version}, got {actual_version}') - exit(1) - print(f'Version verification successful: {actual_version}') - " - - - name: Verify setup.py version - run: | - python -c " - import sys - sys.path.insert(0, '.') - from setup import get_version - version = get_version() - print(f'setup.py get_version() returns: {version}') - " - - - name: Build package + - name: Verify version for PyPI + if: github.ref == 'refs/heads/main' && github.event_name == 'push' run: | - # Clean any previous builds - rm -rf dist/ build/ *.egg-info/ - - # Double-check we're using the correct version before building python -c " import re with open('agentx/version.py', 'r') as f: content = f.read() version = re.search(r'VERSION = \"([^\"]+)\"', content).group(1) - print(f'Building package with version: {version}') + print(f'Version to be published to PyPI: {version}') " - python -m build - - - name: Verify built package version + - name: Build package run: | - # Verify the built package has the correct version - python -c " - import tarfile - import os - import re - - # Find the built package - dist_files = [f for f in os.listdir('dist') if f.endswith('.tar.gz')] - if not dist_files: - print('ERROR: No tar.gz package found in dist/') - exit(1) - - package_file = dist_files[0] - print(f'Checking package: {package_file}') - - # Extract and check version - with tarfile.open(f'dist/{package_file}', 'r:gz') as tar: - # Find the PKG-INFO file - pkg_info_files = [f for f in tar.getnames() if f.endswith('PKG-INFO')] - if pkg_info_files: - pkg_info = tar.extractfile(pkg_info_files[0]) - content = pkg_info.read().decode('utf-8') - print(f'PKG-INFO content:\\n{content}') - version_match = re.search(r'Version: (.+)', content) - if version_match: - package_version = version_match.group(1) - print(f'Package version: {package_version}') - - # Compare with expected version - with open('agentx/version.py', 'r') as f: - version_content = f.read() - expected_version = re.search(r'VERSION = \"([^\"]+)\"', version_content).group(1) - - if package_version != expected_version: - print(f'ERROR: Package version mismatch! Expected {expected_version}, got {package_version}') - exit(1) - print('Package version verification successful!') - else: - print('ERROR: Could not find version in PKG-INFO') - exit(1) - else: - print('ERROR: No PKG-INFO file found in package') - exit(1) - " + python -m build - name: Publish to PyPI env: @@ -184,13 +108,13 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: v${{ steps.bump.outputs.new_version }} - release_name: Release v${{ steps.bump.outputs.new_version }} + tag_name: v${{ steps.version.outputs.new_version }} + release_name: Release v${{ steps.version.outputs.new_version }} body: | - Automated release for version ${{ steps.bump.outputs.new_version }} + Automated release for version ${{ steps.version.outputs.new_version }} Changes in this release: - - Automated version bump from ${{ steps.current_version.outputs.current_version }} to ${{ steps.bump.outputs.new_version }} + - Automated version bump - PyPI package update draft: false prerelease: false diff --git a/agentx/version.py b/agentx/version.py index 3daf705..c51e7af 100644 --- a/agentx/version.py +++ b/agentx/version.py @@ -1 +1 @@ -VERSION = "0.4.6" +VERSION = "0.4.7"