Skip to content

Commit 949c010

Browse files
authored
chore(python): include docs/UPGRADING.md in docs/index.rst if it exists (#1245)
* chore(python): include docs/upgrading.rst in docs/index.rst if it exists * lint * use UPGRADING.md instead of upgrading.rst * add migration guide header, update link to doc * make spacing consistent
1 parent f621fda commit 949c010

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

synthtool/gcp/common.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ def py_library(self, **kwargs) -> Path:
258258
):
259259
self.excludes += ["docs/index.rst"]
260260

261+
# Add kwargs to signal that UPGRADING.md should be included in docs/index.rst if it exists
262+
if Path("docs/UPGRADING.md").exists():
263+
kwargs["include_uprading_doc"] = True
264+
261265
# Assume the python-docs-samples Dockerfile is used for samples by default
262266
if "custom_samples_dockerfile" not in kwargs:
263267
kwargs["custom_samples_dockerfile"] = False

synthtool/gcp/templates/python_library/docs/index.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,24 @@ API Reference
1414
{{ version }}/services
1515
{{ version }}/types
1616
{% endfor %}
17-
{%- if migration_guide_version %}
17+
{% if include_uprading_doc %}
1818
Migration Guide
1919
---------------
2020

21-
See the guide below for instructions on migrating to the {{ migration_guide_version }} release of this library.
21+
See the guide below for instructions on migrating to the latest version.
2222

2323
.. toctree::
2424
:maxdepth: 2
2525

26-
UPGRADING
26+
 UPGRADING
27+
2728
{% endif %}
2829
Changelog
2930
---------
3031

3132
For a list of all ``{{ metadata['repo']['distribution_name'] }}`` releases:
3233

3334
.. toctree::
34-
:maxdepth: 2
35+
:maxdepth: 2
3536

36-
changelog
37+
changelog

0 commit comments

Comments
 (0)