<s> import logging <EOL> import click <EOL> from changes . changelog import generate_changelog <EOL> from changes . config import project_config , store_settings <EOL> from changes . packaging import build_distributions , install_package , upload_package , install_from_pypi <EOL> from changes . vcs import tag_and_push , commit_version_change , create_github_release , upload_release_distributions <EOL> from changes . verification import run_tests <EOL> from changes . version import increment_version <EOL> log = logging . getLogger ( __name__ ) <EOL> def publish ( context ) : <EOL> """<STR_LIT>""" <EOL> commit_version_change ( context ) <EOL> if context . github : <EOL> project_settings = project_config ( context . module_name ) <EOL> if not project_settings [ '<STR_LIT>' ] : <EOL> click . echo ( '<STR_LIT>' ) <EOL> click . pause ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> click . launch ( '<STR_LIT>' ) <EOL> project_settings [ '<STR_LIT>' ] = click . prompt ( '<STR_LIT>' ) <EOL> store_settings ( context . module_name , project_settings ) <EOL> description = click . prompt ( '<STR_LIT>' ) <EOL> upload_url = create_github_release ( context , project_settings [ '<STR_LIT>' ] , description ) <EOL> upload_release_distributions ( <EOL> context , <EOL> project_settings [ '<STR_LIT>' ] , <EOL> build_distributions ( context ) , <EOL> upload_url , <EOL> ) <EOL> click . pause ( '<STR_LIT>' ) <EOL> click . launch ( '<STR_LIT>' . format ( context . repo_url , context . new_version ) ) <EOL> else : <EOL> tag_and_push ( context ) <EOL> def perform_release ( context ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> run_tests ( ) <EOL> if not context . skip_changelog : <EOL> generate_changelog ( context ) <EOL> increment_version ( context ) <EOL> build_distributions ( context ) <EOL> install_package ( context ) <EOL> upload_package ( context ) <EOL> install_from_pypi ( context ) <EOL> publish ( context ) <EOL> except : <EOL> log . exception ( '<STR_LIT>' ) </s>
