forked from LBRYCommunity/lbry-sdk
add release_texts to release.py
This commit is contained in:
parent
af43b21ef6
commit
f8a7d2ebe2
1 changed files with 29 additions and 10 deletions
|
@ -29,6 +29,9 @@ def get_github():
|
||||||
with open(config_path, 'r') as config_file:
|
with open(config_path, 'r') as config_file:
|
||||||
config = json.load(config_file)
|
config = json.load(config_file)
|
||||||
return github3.login(token=config['token'])
|
return github3.login(token=config['token'])
|
||||||
|
|
||||||
|
token = os.environ.get("GH_TOKEN")
|
||||||
|
if not token:
|
||||||
print('GitHub Credentials')
|
print('GitHub Credentials')
|
||||||
username = input('username: ')
|
username = input('username: ')
|
||||||
password = getpass('password: ')
|
password = getpass('password: ')
|
||||||
|
@ -38,7 +41,8 @@ def get_github():
|
||||||
)
|
)
|
||||||
with open(config_path, 'w') as config_file:
|
with open(config_path, 'w') as config_file:
|
||||||
json.dump({'token': gh.token}, config_file)
|
json.dump({'token': gh.token}, config_file)
|
||||||
return github3.login(token=gh.token)
|
token = gh.token
|
||||||
|
return github3.login(token=token)
|
||||||
|
|
||||||
|
|
||||||
def get_labels(pr, prefix):
|
def get_labels(pr, prefix):
|
||||||
|
@ -54,6 +58,7 @@ def get_label(pr, prefix):
|
||||||
|
|
||||||
|
|
||||||
BACKWARDS_INCOMPATIBLE = 'backwards-incompatible:'
|
BACKWARDS_INCOMPATIBLE = 'backwards-incompatible:'
|
||||||
|
RELEASE_TEXT = "release-text:"
|
||||||
|
|
||||||
|
|
||||||
def get_backwards_incompatible(desc: str):
|
def get_backwards_incompatible(desc: str):
|
||||||
|
@ -62,6 +67,12 @@ def get_backwards_incompatible(desc: str):
|
||||||
yield line[len(BACKWARDS_INCOMPATIBLE):]
|
yield line[len(BACKWARDS_INCOMPATIBLE):]
|
||||||
|
|
||||||
|
|
||||||
|
def get_release_text(desc: str):
|
||||||
|
for line in desc.splitlines():
|
||||||
|
if line.startswith(RELEASE_TEXT):
|
||||||
|
yield line[len(RELEASE_TEXT):]
|
||||||
|
|
||||||
|
|
||||||
def get_previous_final(repo, current_release):
|
def get_previous_final(repo, current_release):
|
||||||
assert current_release.rc is not None, "Need an rc to find the previous final release."
|
assert current_release.rc is not None, "Need an rc to find the previous final release."
|
||||||
previous = None
|
previous = None
|
||||||
|
@ -139,6 +150,7 @@ def release(args):
|
||||||
previous_release = repo.release_from_tag(current_version.tag)
|
previous_release = repo.release_from_tag(current_version.tag)
|
||||||
|
|
||||||
incompats = []
|
incompats = []
|
||||||
|
release_texts = []
|
||||||
areas = {}
|
areas = {}
|
||||||
for pr in gh.search_issues(f"merged:>={previous_release._json_data['created_at']} repo:lbryio/lbry"):
|
for pr in gh.search_issues(f"merged:>={previous_release._json_data['created_at']} repo:lbryio/lbry"):
|
||||||
for area_name in get_labels(pr, 'area'):
|
for area_name in get_labels(pr, 'area'):
|
||||||
|
@ -146,6 +158,8 @@ def release(args):
|
||||||
type_label = get_label(pr, "type")
|
type_label = get_label(pr, "type")
|
||||||
for incompat in get_backwards_incompatible(pr.body):
|
for incompat in get_backwards_incompatible(pr.body):
|
||||||
incompats.append(f' * [{area_name}] {incompat.strip()} ({pr.html_url})')
|
incompats.append(f' * [{area_name}] {incompat.strip()} ({pr.html_url})')
|
||||||
|
for incompat in get_release_text(pr.body):
|
||||||
|
release_texts.append(f' * [{area_name}] {incompat.strip()} ({pr.html_url})')
|
||||||
if not (args.action == '*-rc' and type_label == 'fixup'):
|
if not (args.action == '*-rc' and type_label == 'fixup'):
|
||||||
area.append(f' * [{type_label}] {pr.title} ({pr.html_url}) by {pr.user["login"]}')
|
area.append(f' * [{type_label}] {pr.title} ({pr.html_url}) by {pr.user["login"]}')
|
||||||
|
|
||||||
|
@ -156,6 +170,11 @@ def release(args):
|
||||||
w = lambda s: body.write(s+'\n')
|
w = lambda s: body.write(s+'\n')
|
||||||
|
|
||||||
w(f'## [{new_version}] - {date.today().isoformat()}')
|
w(f'## [{new_version}] - {date.today().isoformat()}')
|
||||||
|
if release_texts:
|
||||||
|
w('')
|
||||||
|
for release_text in release_texts:
|
||||||
|
w(release_text)
|
||||||
|
w('')
|
||||||
if incompats:
|
if incompats:
|
||||||
w('')
|
w('')
|
||||||
w(f'### Backwards Incompatible Changes')
|
w(f'### Backwards Incompatible Changes')
|
||||||
|
|
Loading…
Reference in a new issue