Skip to content

Commit 3c546ee

Browse files
authored
feat(librarian): support legacylibrarian "release-only" mode (#16130)
When we have migrated generation to librarian, we will still use legacylibrarian for releasing - including the Docker image used to bump versions. However, in that mode legacylibrarian won't provide a list of changes, so we shouldn't update the per-library changelog files. Fixes googleapis/librarian#4660
1 parent e649a90 commit 3c546ee

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

.generator/cli.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,8 @@ def handle_release_stage(
16581658
for library_release_data in libraries_to_prep_for_release:
16591659
version = library_release_data["version"]
16601660
library_id = library_release_data["id"]
1661-
library_changes = library_release_data["changes"]
1661+
# changes is optional
1662+
library_changes = library_release_data.get("changes")
16621663
tag_format = library_release_data["tag_format"]
16631664

16641665
# Get previous version from state.yaml
@@ -1672,16 +1673,17 @@ def handle_release_stage(
16721673
path_to_library = f"packages/{library_id}" if is_mono_repo else "."
16731674

16741675
_update_version_for_library(repo, output, path_to_library, version)
1675-
_update_changelog_for_library(
1676-
repo,
1677-
output,
1678-
library_changes,
1679-
version,
1680-
previous_version,
1681-
library_id,
1682-
is_mono_repo,
1683-
tag_format,
1684-
)
1676+
if library_changes is not None:
1677+
_update_changelog_for_library(
1678+
repo,
1679+
output,
1680+
library_changes,
1681+
version,
1682+
previous_version,
1683+
library_id,
1684+
is_mono_repo,
1685+
tag_format,
1686+
)
16851687

16861688
except Exception as e:
16871689
raise ValueError(f"Release stage failed: {e}") from e

0 commit comments

Comments
 (0)