diff --git a/tasks/release.py b/tasks/release.py index 5e0b11483a938..394f239f7f879 100644 --- a/tasks/release.py +++ b/tasks/release.py @@ -132,8 +132,9 @@ def __get_force_option(force: bool) -> str: return force_option -def __tag_single_module(ctx, module, agent_version, commit, push, force_option, devel): +def __tag_single_module(ctx, module, agent_version, commit, force_option, devel): """Tag a given module.""" + tags = [] for tag in module.tag(agent_version): if devel: tag += "-devel" @@ -146,9 +147,8 @@ def __tag_single_module(ctx, module, agent_version, commit, push, force_option, message = f"Could not create tag {tag}. Please rerun the task to retry creating the tags (you may need the --force option)" raise Exit(color_message(message, "red"), code=1) print(f"Created tag {tag}") - if push: - ctx.run(f"git push origin {tag}{force_option}") - print(f"Pushed tag {tag}") + tags.append(tag) + return tags @task @@ -173,11 +173,17 @@ def tag_modules(ctx, agent_version, commit="HEAD", verify=True, push=True, force check_version(agent_version) force_option = __get_force_option(force) + tags = [] for module in get_default_modules().values(): # Skip main module; this is tagged at tag_version via __tag_single_module. if module.should_tag and module.path != ".": - __tag_single_module(ctx, module, agent_version, commit, push, force_option, devel) + new_tags = __tag_single_module(ctx, module, agent_version, commit, force_option, devel) + tags.extend(new_tags) + if push: + tags_list = ' '.join(tags) + ctx.run(f"git push origin {tags_list}{force_option}") + print(f"Pushed tag {tags_list}") print(f"Created module tags for version {agent_version}") @@ -203,7 +209,11 @@ def tag_version(ctx, agent_version, commit="HEAD", verify=True, push=True, force # Always tag the main module force_option = __get_force_option(force) - __tag_single_module(ctx, get_default_modules()["."], agent_version, commit, push, force_option, devel) + tags = __tag_single_module(ctx, get_default_modules()["."], agent_version, commit, force_option, devel) + if push: + tags_list = ' '.join(tags) + ctx.run(f"git push origin {tags_list}{force_option}") + print(f"Pushed tag {tags_list}") print(f"Created tags for version {agent_version}")