Module continuous_delivery_scripts.tag_and_release
Orchestrates release process.
Functions
def main() ‑> None-
Expand source code
def main() -> None: """Commands. Returns: success code (0) if successful; failure code otherwise. """ parser = argparse.ArgumentParser(description="Releases the project.") parser.add_argument( "-t", "--release-type", help="type of release to perform", required=True, type=str, choices=CommitType.choices(), ) parser.add_argument("-b", "--current-branch", help="Name of the current branch", nargs="?") parser.add_argument( "-v", "--verbose", action="count", default=0, help="Verbosity, by default errors are reported.", ) args = parser.parse_args() set_log_level(args.verbose) try: tag_and_release(CommitType.parse(args.release_type), args.current_branch) except Exception as e: log_exception(logger, e) sys.exit(1)Commands.
Returns -----= success code (0) if successful; failure code otherwise.
def tag_and_release(mode: CommitType,
current_branch: str | None = None) ‑> None-
Expand source code
def tag_and_release(mode: CommitType, current_branch: Optional[str] = None) -> None: """Tags and releases. Updates repository with changes and releases package to PyPI for general availability. Args: mode: release mode current_branch: current branch in case the current branch cannot easily be determined (e.g. on CI) """ get_language_specifics().check_credentials() is_new_version, version, version_elements = version_project(mode) logger.info(f"Current version: {version}") if not version: raise ValueError("Undefined version.") if mode == CommitType.DEVELOPMENT: return files_changed_by_release_preparation = get_language_specifics().prepare_release( Path(str(configuration.get_value(ConfigurationVariable.PROJECT_ROOT))), version, is_new_version ) # The documentation folder will be emptied when the documentation is updated _update_documentation() spdx_project: Optional["SpdxProject"] = None generate_summary = configuration.get_value(ConfigurationVariable.GENERATE_LICENSING_SUMMARY_ON_RELEASE) if isinstance(generate_summary, str): generate_summary = generate_summary.strip().lower() in ("true", "1", "yes") if generate_summary: # Add summaries after the documentation output has been cleared and regenerated. spdx_project = _update_licensing_summary() insert_licence_header(0) _update_repository( mode, is_new_version, version, current_branch, version_elements, files_changed_by_release_preparation ) if is_new_version: if get_language_specifics().should_clean_before_packaging(): _clean_repository() plugin = get_language_specifics() if plugin.should_include_spdx_in_package(): if spdx_project is None and plugin.can_get_project_metadata(): spdx_project = plugin.get_current_spdx_project() if spdx_project: _generate_spdx_reports(spdx_project) get_language_specifics().package_software(mode, version) get_language_specifics().release_package_to_repository(mode, version)Tags and releases.
Updates repository with changes and releases package to PyPI for general availability.
- Args
- -----=
mode- release mode
current_branch- current branch in case the current branch cannot easily
be determined (e.g. on CI)