π The fast, Pythonic way to build MCP servers and clients.
Skip published docs update for prereleases (#4224)
Jeremiah Lowin986353f26b64
diff --git a/.github/workflows/publish-fastmcp.yml b/.github/workflows/publish-fastmcp.ymlindex e62151275..83b429047 100644--- a/.github/workflows/publish-fastmcp.yml+++ b/.github/workflows/publish-fastmcp.yml@@ -15,6 +15,9 @@ jobs:name: Upload fastmcp to PyPIruns-on: ubuntu-latestif: github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'release')+ outputs:+ is_prerelease: ${{ steps.package_version.outputs.is_prerelease }}+ version: ${{ steps.package_version.outputs.version }}steps:- name: Checkout@@ -29,6 +32,35 @@ jobs:- name: Build fastmcprun: uv build --package fastmcp+ - name: Read built package version+ id: package_version+ run: |+ python - <<'PY' >> "$GITHUB_OUTPUT"+ import email.parser+ import re+ import zipfile+ from pathlib import Path++ wheel = next(Path("dist").glob("fastmcp-*.whl"))+ metadata_name = next(+ name for name in zipfile.ZipFile(wheel).namelist()+ if name.endswith(".dist-info/METADATA")+ )+ metadata = email.parser.Parser().parsestr(+ zipfile.ZipFile(wheel).read(metadata_name).decode()+ )+ version = metadata["Version"]+ public_version = version.partition("+")[0]+ is_prerelease = bool(+ re.search(+ r"(?i)(?:^|[0-9.])(?:a|b|c|rc|alpha|beta|pre|preview|dev)[0-9]*",+ public_version,+ )+ )+ print(f"version={version}")+ print(f"is_prerelease={str(is_prerelease).lower()}")+ PY+- name: Verify matching fastmcp-slim is publishedrun: |SLIM_VERSION=$(python - <<'PY'@@ -90,7 +122,7 @@ jobs:name: Update published-docs branchruns-on: ubuntu-latestneeds: pypi-publish- if: github.event_name == 'workflow_run' && github.event.workflow_run.event == 'release'+ if: github.event_name == 'workflow_run' && github.event.workflow_run.event == 'release' && needs['pypi-publish'].outputs.is_prerelease != 'true'timeout-minutes: 2permissions:contents: write