Add --overwrite to the upload script
This commit is contained in:
parent
c70508edb1
commit
3545280e1d
1 changed files with 12 additions and 4 deletions
|
@ -51,11 +51,16 @@ def main():
|
|||
github = GitHub(auth_token())
|
||||
releases = github.repos(ELECTRON_REPO).releases.get()
|
||||
tag_exists = False
|
||||
for release in releases:
|
||||
if not release['draft'] and release['tag_name'] == args.version:
|
||||
for r in releases:
|
||||
if not r['draft'] and r['tag_name'] == args.version:
|
||||
release = r
|
||||
tag_exists = True
|
||||
break
|
||||
|
||||
assert tag_exists == args.overwrite, \
|
||||
'You have to pass --overwrite to overwrite a published release'
|
||||
|
||||
if not args.overwrite:
|
||||
release = create_or_get_release_draft(github, releases, args.version,
|
||||
tag_exists)
|
||||
|
||||
|
@ -112,6 +117,9 @@ def parse_args():
|
|||
parser = argparse.ArgumentParser(description='upload distribution file')
|
||||
parser.add_argument('-v', '--version', help='Specify the version',
|
||||
default=ELECTRON_VERSION)
|
||||
parser.add_argument('-o', '--overwrite',
|
||||
help='Overwrite a published release',
|
||||
action='store_true')
|
||||
parser.add_argument('-p', '--publish-release',
|
||||
help='Publish the release',
|
||||
action='store_true')
|
||||
|
|
Loading…
Reference in a new issue