diff options
author | Florian Bruhin <me@the-compiler.org> | 2019-09-25 21:09:44 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-09-25 21:09:44 +0200 |
commit | f2a09a97b2562e8180600608735f6980fdf373d2 (patch) | |
tree | bb03a4ecf3991a4a136f0764de549dd78acf72a3 | |
parent | fe32e00a4e1b5a7cfd49638501a072df243636c2 (diff) | |
download | qutebrowser-f2a09a97b2562e8180600608735f6980fdf373d2.tar.gz qutebrowser-f2a09a97b2562e8180600608735f6980fdf373d2.zip |
build_release: Add retry functionality for GitHub upload
-rwxr-xr-x | scripts/dev/build_release.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py index 006b1a99a..7e7e6051f 100755 --- a/scripts/dev/build_release.py +++ b/scripts/dev/build_release.py @@ -407,6 +407,7 @@ def github_upload(artifacts, tag): tag: The name of the release tag """ import github3 + import github3.exceptions utils.print_title("Uploading to github...") token = read_github_token() @@ -421,9 +422,17 @@ def github_upload(artifacts, tag): raise Exception("No release found for {!r}!".format(tag)) for filename, mimetype, description in artifacts: - with open(filename, 'rb') as f: - basename = os.path.basename(filename) - asset = release.upload_asset(mimetype, basename, f) + while True: + try: + with open(filename, 'rb') as f: + basename = os.path.basename(filename) + asset = release.upload_asset(mimetype, basename, f) + except github3.exceptions.ConnectionError as e: + utils.print_col('Failed to upload: {}'.format(e), 'red') + print("Press Enter to retry...") + input() + else: + break asset.edit(basename, description) |