From cc23515a3541f363232ee7165844253a222503c9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Dec 2017 10:28:43 +0530 Subject: [PATCH] Make the publish script a little smarter --- publish.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/publish.py b/publish.py index 0750b4536..e4583ed6f 100755 --- a/publish.py +++ b/publish.py @@ -43,6 +43,7 @@ def run_build(args): def run_tag(args): + call('git push') call('git tag -s v{0} -m version-{0}'.format(version)) call('git push origin v{0}'.format(version)) @@ -274,7 +275,14 @@ def run_upload(args): 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(): + require_git_master() parser = argparse.ArgumentParser(description='Publish kitty') parser.add_argument( '--only', @@ -292,6 +300,13 @@ def main(): actions = ALL_ACTIONS[idx:] if args.only: 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: print('Running', action) cwd = os.getcwd()