From 029093282831597f42f991e49ebd32c006f3ca95 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 24 Sep 2018 13:38:37 +0530 Subject: [PATCH] fix(prerelease): allow making prerelease for bench - fixed the existing funtionality of prerelease Signed-off-by: Ameya Shenoy --- bench/release.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bench/release.py b/bench/release.py index 529be159..60384820 100755 --- a/bench/release.py +++ b/bench/release.py @@ -87,7 +87,8 @@ def bump(bench_path, app, bump_type, from_branch, to_branch, remote, owner, repo commit_changes(repo_path, new_version, to_branch) tag_name = create_release(repo_path, new_version, from_branch=from_branch, to_branch=to_branch) push_release(repo_path, from_branch=from_branch, to_branch=to_branch, remote=remote) - create_github_release(repo_path, tag_name, message, remote=remote, owner=owner, repo_name=repo_name) + prerelease = True if 'beta' in new_version else False + create_github_release(repo_path, tag_name, message, remote=remote, owner=owner, repo_name=repo_name, prerelease=prerelease) print('Released {tag} for {repo_path}'.format(tag=tag_name, repo_path=repo_path)) def update_branches_and_check_for_changelog(repo_path, from_branch='develop', to_branch='master', remote='upstream'): @@ -173,14 +174,13 @@ def get_bumped_version(version, bump_type): v.prerelease = None elif bump_type == 'prerelease': - if v.prerelease == None: + if v.prerelease == (): v.prerelease = ('beta',) - elif len(v.prerelease)==1: - v.prerelease[1] = '1' - + if len(v.prerelease)==1: + v.prerelease = ('beta', '1') else: - v.prerelease[1] = str(int(v.prerelease[1]) + 1) + v.prerelease = ('beta', str(int(v.prerelease[1]) + 1)) return str(v) @@ -290,7 +290,7 @@ def push_release(repo_path, from_branch='develop', to_branch='master', remote='u print(g.push(remote, *args)) def create_github_release(repo_path, tag_name, message, remote='upstream', owner='frappe', repo_name=None, - gh_username=None, gh_password=None): + gh_username=None, gh_password=None, prerelease=False): print('creating release on github') @@ -308,7 +308,7 @@ def create_github_release(repo_path, tag_name, message, remote='upstream', owner 'name': 'Release ' + tag_name, 'body': message, 'draft': False, - 'prerelease': False + 'prerelease': prerelease } for i in range(3): try: