diff --git a/synthtool/gcp/common.py b/synthtool/gcp/common.py index d12859241..9083c7bb7 100644 --- a/synthtool/gcp/common.py +++ b/synthtool/gcp/common.py @@ -258,6 +258,10 @@ def py_library(self, **kwargs) -> Path: ): self.excludes += ["docs/index.rst"] + # Add kwargs to signal that UPGRADING.md should be included in docs/index.rst if it exists + if Path("docs/UPGRADING.md").exists(): + kwargs["include_uprading_doc"] = True + # Assume the python-docs-samples Dockerfile is used for samples by default if "custom_samples_dockerfile" not in kwargs: kwargs["custom_samples_dockerfile"] = False diff --git a/synthtool/gcp/templates/python_library/docs/index.rst b/synthtool/gcp/templates/python_library/docs/index.rst index 03b24c37f..1feedfe4a 100644 --- a/synthtool/gcp/templates/python_library/docs/index.rst +++ b/synthtool/gcp/templates/python_library/docs/index.rst @@ -14,16 +14,17 @@ API Reference {{ version }}/services {{ version }}/types {% endfor %} -{%- if migration_guide_version %} +{% if include_uprading_doc %} Migration Guide --------------- -See the guide below for instructions on migrating to the {{ migration_guide_version }} release of this library. +See the guide below for instructions on migrating to the latest version. .. toctree:: :maxdepth: 2 - UPGRADING +  UPGRADING + {% endif %} Changelog --------- @@ -31,6 +32,6 @@ Changelog For a list of all ``{{ metadata['repo']['distribution_name'] }}`` releases: .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - changelog + changelog