Changeset View
Changeset View
Standalone View
Standalone View
python_modules/automation/automation/release/cli.py
Show All 11 Lines | |||||
import subprocess | import subprocess | ||||
import sys | import sys | ||||
import tempfile | import tempfile | ||||
import urllib | import urllib | ||||
import click | import click | ||||
import packaging.version | import packaging.version | ||||
import requests | import requests | ||||
import slackclient | |||||
import virtualenv | import virtualenv | ||||
from automation.git import ( | from automation.git import ( | ||||
get_git_repo_branch, | get_git_repo_branch, | ||||
get_most_recent_git_tag, | get_most_recent_git_tag, | ||||
git_check_status, | git_check_status, | ||||
git_commit_updates, | git_commit_updates, | ||||
git_push, | git_push, | ||||
git_repo_root, | git_repo_root, | ||||
git_user, | |||||
set_git_tag, | set_git_tag, | ||||
) | ) | ||||
from automation.utils import which_ | from automation.utils import which_ | ||||
from dagster import check | from dagster import check | ||||
from .dagster_module_publisher import DagsterModulePublisher | from .dagster_module_publisher import DagsterModulePublisher | ||||
from .pypirc import ConfigFileError, RCParser | from .pypirc import ConfigFileError, RCParser | ||||
from .utils import format_module_versions | from .utils import format_module_versions, post_to_dagster_slack | ||||
CLI_HELP = """Tools to help tag and publish releases of the Dagster projects. | CLI_HELP = """Tools to help tag and publish releases of the Dagster projects. | ||||
By convention, these projects live in a single monorepo, and the submodules are versioned in | By convention, these projects live in a single monorepo, and the submodules are versioned in | ||||
lockstep to avoid confusion, i.e., if dagster is at 0.3.0, dagit is also expected to be at | lockstep to avoid confusion, i.e., if dagster is at 0.3.0, dagit is also expected to be at | ||||
0.3.0. | 0.3.0. | ||||
Versions are tracked in the version.py files present in each submodule and in the git tags | Versions are tracked in the version.py files present in each submodule and in the git tags | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | def publish(autoclean, dry_run): | ||||
dmp.check_directory_structure() | dmp.check_directory_structure() | ||||
click.echo("Publishing packages to PyPI...") | click.echo("Publishing packages to PyPI...") | ||||
dmp.publish_all(dry_run=dry_run) | dmp.publish_all(dry_run=dry_run) | ||||
parsed_version = packaging.version.parse(checked_version) | parsed_version = packaging.version.parse(checked_version) | ||||
if not parsed_version.is_prerelease and not dry_run: | if not parsed_version.is_prerelease and not dry_run: | ||||
slack_client = slackclient.SlackClient(os.environ["SLACK_RELEASE_BOT_TOKEN"]) | post_to_dagster_slack(checked_version) | ||||
slack_client.api_call( | |||||
"chat.postMessage", | |||||
channel="#general", | |||||
text=("{git_user} just published a new version: {version}.").format( | |||||
git_user=git_user(), version=checked_version | |||||
), | |||||
) | |||||
@cli.command() | @cli.command() | ||||
@click.argument("ver") | @click.argument("ver") | ||||
@click.option("--dry-run", is_flag=True) | @click.option("--dry-run", is_flag=True) | ||||
def release(ver, dry_run): | def release(ver, dry_run): | ||||
"""Tags all submodules for a new release. | """Tags all submodules for a new release. | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |