def publish(context): """Publishes the project""" commit_version_change(context) if context.github: # github token project_settings = project_config(context.module_name) if not project_settings['gh_token']: click.echo('You need a GitHub token for changes to create a release.') click.pause('Press [enter] to launch the GitHub "New personal access ' 'token" page, to create a token for changes.') click.launch('https://github.com/settings/tokens/new') project_settings['gh_token'] = click.prompt('Enter your changes token') store_settings(context.module_name, project_settings) description = click.prompt('Describe this release') upload_url = create_github_release(context, project_settings['gh_token'], description) upload_release_distributions( context, project_settings['gh_token'], build_distributions(context), upload_url, ) click.pause('Press [enter] to review and update your new release') click.launch('{0}/releases/tag/{1}'.format(context.repo_url, context.new_version)) else: tag_and_push(context)
def test_signed_tag(mocker): dry_run = mocker.patch('changes.shell.dry_run') probe = mocker.patch('changes.probe.has_signing_key') probe.return_value = True vcs.tag_and_push(context) dry_run.assert_has_calls( ['git tag --sign 0.0.2 --message="0.0.2"', 'git push --tags'])
def test_tag_and_push(mocker): dry_run = mocker.patch('changes.shell.dry_run') probe = mocker.patch('changes.probe.has_signing_key') probe.return_value = False vcs.tag_and_push(context) dry_run.assert_has_calls([ call('git tag --annotate 0.0.2 --message="0.0.2"', True), call('git push --tags', True) ])
def test_signed_tag(mocker): dry_run = mocker.patch('changes.shell.dry_run') probe = mocker.patch('changes.probe.has_signing_key') probe.return_value = True vcs.tag_and_push(context) dry_run.assert_has_calls([ call('git tag --sign 0.0.2 --message="0.0.2"', True), call('git push --tags', True) ])
def test_tag_and_push(mocker): with CliRunner().isolated_filesystem(): dry_run = mocker.patch('changes.shell.dry_run') probe = mocker.patch('changes.probe.has_signing_key') probe.return_value = False vcs.tag_and_push(context) dry_run.assert_has_calls([ mocker.call('git tag --annotate 0.0.2 --message="0.0.2"', True), mocker.call('git push --tags', True), ])
def perform_release(context): """Executes the release process.""" try: run_tests() if not context.skip_changelog: generate_changelog(context) increment_version(context) build_package(context) install_package(context) upload_package(context) install_from_pypi(context) commit_version_change(context) tag_and_push(context) except: log.exception('Error releasing')
def test_tag_and_push(): vcs.tag_and_push(context)
def tag(context): """Tags your git repo with the new version number""" tag_and_push(context.obj)