def fetch_changelogs(release_name, branch='master'): fetch_changelog('editor', release_name, EDITOR_GITHUB_REP, branch=branch) print(echocall(['git', 'log', f'origin/{branch}..HEAD'])) if yes('Are the above commits ready to be pushed?', default='n'): doechocall('Pushing changes to GitHub', ['git', 'push', 'origin', branch, '--follow-tags'])
def update_version_in_json_used_by_menuinst(build_dir, release_name, package_name, **extra_kwargs): chdir(build_dir) version = short(release_name) menuinst_file = join('condarecipe', package_name, 'larray-editor.json') with open(menuinst_file) as mf: data = json.load(mf) menu_items = data['menu_items'] for i, menu_item in enumerate(menu_items): if 'webbrowser' in menu_item: menu_items[i][ 'webbrowser'] = f'http://larray.readthedocs.io/en/{version}' with open(menuinst_file, mode='w') as mf: json.dump(data, mf, indent=4) # check and add to next commit print(echocall(['git', 'diff', menuinst_file])) if no('Do the version update changes look right?'): exit(1) doechocall('Adding', ['git', 'add', menuinst_file])
def fetch_changelog(section_name, release_name, github_rep, rel_changes_dir='/doc/source/changes', branch='master'): fname = relname2fname(release_name) # get changelog file content from github repository url = github_rep.replace( 'github.com', 'raw.githubusercontent.com') + f'/{branch}/{rel_changes_dir}/{fname}' req = requests.get(url) if req.status_code != requests.codes.ok: raise ValueError(f"Content at URL {url} could not be found.") # save in local directory fpath = Path('.') / 'changes' / section_name / fname fpath.write_text(req.text, encoding="utf-8") doechocall('Adding', ['git', 'add', str(fpath)]) doechocall('Committing', [ 'git', 'commit', '-m', f'fetched {section_name} changelog for {short(release_name)}', str(fpath) ])