Make the publish script a little smarter

This commit is contained in:
Kovid Goyal 2017-12-01 10:28:43 +05:30
parent 8d2a720fb9
commit cc23515a35
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -43,6 +43,7 @@ def run_build(args):
def run_tag(args): def run_tag(args):
call('git push')
call('git tag -s v{0} -m version-{0}'.format(version)) call('git tag -s v{0} -m version-{0}'.format(version))
call('git push origin v{0}'.format(version)) call('git push origin v{0}'.format(version))
@ -274,7 +275,14 @@ def run_upload(args):
gh() gh()
def require_git_master(branch='master'):
b = subprocess.check_output(['git', 'symbolic-ref', '--short', 'HEAD']).decode('utf-8').strip()
if b != branch:
raise SystemExit('You must be in the {} got branch'.format(branch))
def main(): def main():
require_git_master()
parser = argparse.ArgumentParser(description='Publish kitty') parser = argparse.ArgumentParser(description='Publish kitty')
parser.add_argument( parser.add_argument(
'--only', '--only',
@ -292,6 +300,13 @@ def main():
actions = ALL_ACTIONS[idx:] actions = ALL_ACTIONS[idx:]
if args.only: if args.only:
del actions[1:] del actions[1:]
else:
try:
ans = input('Publish version \033[91m{}\033[m (y/n): '.format(version))
except KeyboardInterrupt:
ans = 'n'
if ans.lower() != 'y':
return
for action in actions: for action in actions:
print('Running', action) print('Running', action)
cwd = os.getcwd() cwd = os.getcwd()