From db359ae75c5abe69a02e56a007feaa1846797c9a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 26 Sep 2013 20:32:11 +0800 Subject: [PATCH] Upload the asset after release note is created. --- script/upload.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/script/upload.py b/script/upload.py index 9cfba99347..148751bf1c 100755 --- a/script/upload.py +++ b/script/upload.py @@ -38,7 +38,8 @@ def main(): subprocess.check_call([sys.executable, create_dist]) github = GitHub(auth_token()) - print create_or_get_release_draft(github, args.version) + release_id = create_or_get_release_draft(github, args.version) + upload_asset(github, release_id, os.path.join(DIST_DIR, DIST_NAME)) # upload(auth_token) # if not args.no_update_version: # update_version(auth_token) @@ -93,6 +94,14 @@ def create_release_draft(github, tag): return r['id'] +def upload_asset(github, release_id, file_path): + params = {'name': os.path.basename(file_path)} + headers = {'Content-Type': 'application/zip'} + files = {'file': open(file_path, 'rb')} + github.repos(ATOM_SHELL_REPO).releases(release_id).assets.post( + params=params, headers=headers, files=files, verify=False) + + def upload(auth_token, version=ATOM_SHELL_VRESION): os.chdir(DIST_DIR)