Returns a 401 error when user is not authenticated #49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Version Check | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| check-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests packaging | |
| - name: Check version against PyPI | |
| run: | | |
| python - <<EOF | |
| import requests | |
| import sys | |
| import re | |
| from packaging import version | |
| # Read version from version.py | |
| with open("src/version.py", "r") as f: | |
| version_content = f.read() | |
| # Extract version string from file | |
| version_match = re.search(r'__version__\s*=\s*["\']([^"\']+)["\']', version_content) | |
| if not version_match: | |
| print("❌ Could not find version in version.py") | |
| sys.exit(1) | |
| local_version = version_match.group(1) | |
| print(f"📦 Local version: {local_version}") | |
| # Get version from PyPI | |
| package_name = "singlestore-mcp-server" | |
| try: | |
| pypi_response = requests.get(f"https://pypi.org/pypi/{package_name}/json") | |
| if pypi_response.status_code == 200: | |
| pypi_data = pypi_response.json() | |
| pypi_version = pypi_data["info"]["version"] | |
| print(f"📦 PyPI version: {pypi_version}") | |
| # Compare versions | |
| if version.parse(local_version) <= version.parse(pypi_version): | |
| print(f"❌ Error: Local version {local_version} is not greater than PyPI version {pypi_version}") | |
| print("Please increment the version in src/version.py") | |
| sys.exit(1) | |
| else: | |
| print(f"✅ Version check passed: {local_version} > {pypi_version}") | |
| else: | |
| if pypi_response.status_code == 404: | |
| print(f"ℹ️ Package {package_name} not found on PyPI. This might be the first release.") | |
| else: | |
| print(f"⚠️ PyPI API returned status code {pypi_response.status_code}") | |
| print(f"Response: {pypi_response.text}") | |
| sys.exit(1) | |
| except Exception as e: | |
| print(f"❌ Error checking PyPI version: {e}") | |
| sys.exit(1) | |
| EOF |