Implement checklists
This commit is contained in:
parent
2c8f1dc59e
commit
aa6291949d
63
release.py
63
release.py
|
@ -25,6 +25,23 @@ parser.add_argument('-c', '--config', dest="config_location", action="store", he
|
|||
parser.add_argument('version', help="Version you wish to release. Use https://semver.org")
|
||||
parser.add_argument('--verbose', help="Enable verbose logging output.", action="store_true", default=False)
|
||||
|
||||
def await_yes_no():
|
||||
accept_words = ["y", "yes", ""]
|
||||
deny_words = ["n", "no"]
|
||||
while True:
|
||||
print("Do you wish to proceed? [Y/n]: ", end="")
|
||||
result = input()
|
||||
|
||||
|
||||
if result.lower() in deny_words:
|
||||
print("Aborted.")
|
||||
exit(1)
|
||||
elif result.lower() not in accept_words:
|
||||
print("Don't understand what you mean.")
|
||||
else:
|
||||
print("OK, executing file operations.")
|
||||
break
|
||||
|
||||
def build_version_string(gsd_num : str, out_name:str, version_number:str, release_type:str, file_extension:str):
|
||||
return f'GSD-{gsd_num}-{out_name}-{version_number}-{release_type}.{file_extension}'
|
||||
|
||||
|
@ -36,6 +53,29 @@ def md5_hash_of(file):
|
|||
|
||||
return file_hash.hexdigest()
|
||||
|
||||
completed_checklists = []
|
||||
def do_checklists(config):
|
||||
if config["checklists"] is None or len(config["checklists"]) == 0:
|
||||
logger.warn("No checklists specified in configuration.")
|
||||
|
||||
for (i, checklist) in enumerate(config["checklists"]):
|
||||
for field in ["checklist_name", "when", "items"]:
|
||||
if checklist[field] is None:
|
||||
logger.error(f'Missing field {field} in checklist {i}')
|
||||
exit(1)
|
||||
|
||||
if len(checklist["items"]) == 0:
|
||||
logger.warn(f'Warning: Checklist "{checklist["checklist_name"]}" has no items."')
|
||||
|
||||
print(f'Confirm that you have completed checklist {checklist["checklist_name"]}:')
|
||||
|
||||
for item in checklist["items"]:
|
||||
print(f'- {item}')
|
||||
|
||||
await_yes_no()
|
||||
|
||||
completed_checklists.append((i, checklist["checklist_name"]))
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -54,6 +94,8 @@ if __name__ == "__main__":
|
|||
|
||||
assert config is not None
|
||||
|
||||
do_checklists(config)
|
||||
|
||||
logger.debug("Config file read.")
|
||||
|
||||
release_dir = f'./{config["releases_directory"]}/{args.version}/'
|
||||
|
@ -109,21 +151,7 @@ if __name__ == "__main__":
|
|||
|
||||
print("")
|
||||
|
||||
accept_words = ["y", "yes", ""]
|
||||
deny_words = ["n", "no"]
|
||||
while True:
|
||||
print("Do you wish to proceed? [Y/n]: ", end="")
|
||||
result = input()
|
||||
|
||||
|
||||
if result.lower() in deny_words:
|
||||
print("Aborted.")
|
||||
exit(1)
|
||||
elif result.lower() not in accept_words:
|
||||
print("Don't understand what you mean.")
|
||||
else:
|
||||
print("OK, executing file operations.")
|
||||
break
|
||||
await_yes_no()
|
||||
|
||||
logger.debug("Ensuring output directories exist.")
|
||||
os.makedirs(release_dir, exist_ok=True)
|
||||
|
@ -155,3 +183,8 @@ if __name__ == "__main__":
|
|||
release_notes.write("Output file manifest (name, md5 hash):\n")
|
||||
for (_, file) in binaries_manifest:
|
||||
release_notes.write(f'{file} {md5_hash_of(file)}\n')
|
||||
release_notes.write("Completed checklists for this release:\n")
|
||||
for (i,checklist_name) in completed_checklists:
|
||||
release_notes.write(f'{checklist_name}\n')
|
||||
for item in config["checklists"][i]["items"]:
|
||||
release_notes.write(f'- {item}\n')
|
||||
|
|
Loading…
Reference in New Issue