def create_github_release(): configure_git() version = get_project_version() if not version: print("Unable to determine the current version") sys.exit(1) tag_exists = (check_exit_code([ f'git show-ref --tags --quiet --verify -- "refs/tags/{version}"' ]) == 0) if not tag_exists: run_process(["git", "tag", version]) run_process(["git", "push", "--tags"]) _, changelog = get_release_info() gh_release_create( REPO_SLUG, version, publish=True, name=f"{PROJECT_NAME} {version}", body=changelog, asset_pattern="dist/*", )
def create_github_release(): try: from github_release import gh_release_create except ModuleNotFoundError: print("Cannot create GitHub release due to missing dependency: github_release") sys.exit(1) configure_git() version = get_project_version() tag = f"{TAG_PREFIX}{version}" if not version: print("Unable to determine the current version") sys.exit(1) tag_exists = ( check_exit_code([f'git show-ref --tags --quiet --verify -- "refs/tags/{tag}"']) == 0 ) if not tag_exists: run_process(["git", "tag", tag]) run_process(["git", "push", "--tags"]) _, changelog = get_release_info() gh_release_create( REPO_SLUG, tag, publish=True, name=f"{PROJECT_NAME} {version}", body=changelog, asset_pattern="dist/*", )
def git_commit_and_push(): configure_git() version = get_project_version() git(["add", PYPROJECT_FILE_NAME]) git(["add", CHANGELOG_FILE_NAME]) if VERSION_STRINGS: for version_file in VERSION_STRINGS: git(["add", version_file]) git(["rm", "--cached", RELEASE_FILE_NAME]) git(["commit", "-m", f"Release {PROJECT_NAME} {version}"]) git(["push", "origin", "HEAD"])
import sys import os sys.path.append(os.path.dirname(__file__)) # noqa from base import ( get_project_version, git, configure_git, PROJECT_TOML_FILE_NAME, CHANGELOG_FILE_NAME, RELEASE_FILE_NAME, ) if __name__ == "__main__": configure_git() version = get_project_version() git(["add", PROJECT_TOML_FILE_NAME]) git(["add", CHANGELOG_FILE_NAME]) git(["rm", "--cached", RELEASE_FILE_NAME]) git(["commit", "-m", f"Release 🍓 {version}"]) git(["push", "origin", "HEAD"])