Skip to content

Commit

Permalink
fix(release): accomodate future branches
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil28297 committed Jul 19, 2019
1 parent dd78011 commit 5699204
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bench/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
'version-12-hotfix': [],
}

releasable_branches = ['master']

github_username = None
github_password = None

Expand All @@ -36,6 +38,9 @@ def release(bench_path, app, bump_type, from_branch, to_branch,
if config.get('branches_to_update'):
branches_to_update.update(config.get('branches_to_update'))

if config.get('releasable_branches'):
releasable_branches.extend(config.get('releasable_branches'),[])

validate(bench_path, config)

bump(bench_path, app, bump_type, from_branch=from_branch, to_branch=to_branch, owner=owner,
Expand Down Expand Up @@ -141,7 +146,7 @@ def get_current_version(repo_path, to_branch):
# TODO clean this up!
version_key = '__version__'

if to_branch.lower() in ['version-11', 'version-12']:
if to_branch.lower() in releasable_branches:
filename = os.path.join(repo_path, os.path.basename(repo_path), '__init__.py')
else:
filename = os.path.join(repo_path, os.path.basename(repo_path), 'hooks.py')
Expand Down Expand Up @@ -195,7 +200,7 @@ def get_bumped_version(version, bump_type):
return str(v)

def set_version(repo_path, version, to_branch):
if to_branch.lower() in ['version-11', 'version-12']:
if to_branch.lower() in releasable_branches:
set_filename_version(os.path.join(repo_path, os.path.basename(repo_path),'__init__.py'), version, '__version__')
else:
set_filename_version(os.path.join(repo_path, os.path.basename(repo_path),'hooks.py'), version, 'staging_version')
Expand Down Expand Up @@ -238,7 +243,7 @@ def commit_changes(repo_path, new_version, to_branch):
repo = git.Repo(repo_path)
app_name = os.path.basename(repo_path)

if to_branch.lower() in ['version-11', 'version-12']:
if to_branch.lower() in releasable_branches:
repo.index.add([os.path.join(app_name, '__init__.py')])
else:
repo.index.add([os.path.join(app_name, 'hooks.py')])
Expand Down

0 comments on commit 5699204

Please sign in to comment.