|
@@ -2,16 +2,17 @@
|
|
|
|
|
|
import argparse
|
|
|
import errno
|
|
|
-from io import StringIO
|
|
|
+import hashlib
|
|
|
import os
|
|
|
import subprocess
|
|
|
import sys
|
|
|
import tempfile
|
|
|
|
|
|
+from io import StringIO
|
|
|
from lib.config import PLATFORM, get_target_arch, get_chromedriver_version, \
|
|
|
- get_platform_key, get_env_var
|
|
|
+ get_platform_key, get_env_var, s3_config
|
|
|
from lib.util import electron_gyp, execute, get_electron_version, \
|
|
|
- parse_version, scoped_cwd
|
|
|
+ parse_version, scoped_cwd, s3put
|
|
|
from lib.github import GitHub
|
|
|
|
|
|
|
|
@@ -125,8 +126,8 @@ def parse_args():
|
|
|
|
|
|
|
|
|
def run_python_script(script, *args):
|
|
|
- script_path = os.path.join(SOURCE_ROOT, 'script', script),
|
|
|
- return execute([sys.executable, script_path] + args)
|
|
|
+ script_path = os.path.join(SOURCE_ROOT, 'script', script)
|
|
|
+ return execute([sys.executable, script_path] + list(args))
|
|
|
|
|
|
|
|
|
def get_electron_build_version():
|
|
@@ -205,10 +206,10 @@ def create_release_draft(github, tag):
|
|
|
|
|
|
|
|
|
def release_electron_checksums(github, release):
|
|
|
- checksums = run_python_script(
|
|
|
- 'merge-electron-checksums.py', '-v', ELECTRON_VERSION)
|
|
|
- upload_io_to_github(github, release,
|
|
|
- 'SHASUMS256.txt', StringIO(checksums), 'text/plain')
|
|
|
+ checksums = run_python_script('merge-electron-checksums.py',
|
|
|
+ '-v', ELECTRON_VERSION)
|
|
|
+ upload_io_to_github(github, release, 'SHASUMS256.txt',
|
|
|
+ StringIO(checksums.decode('utf-8')), 'text/plain')
|
|
|
|
|
|
|
|
|
def upload_electron(github, release, file_path):
|
|
@@ -223,9 +224,11 @@ def upload_electron(github, release, file_path):
|
|
|
pass
|
|
|
|
|
|
# Upload the file.
|
|
|
- name = os.path.dirname(file_path)
|
|
|
with open(file_path, 'rb') as f:
|
|
|
- upload_io_to_github(github, release, name, f, 'application/zip')
|
|
|
+ upload_io_to_github(github, release, filename, f, 'application/zip')
|
|
|
+
|
|
|
+ # Upload the checksum file.
|
|
|
+ upload_sha256_checksum(release['tag_name'], file_path)
|
|
|
|
|
|
|
|
|
def upload_io_to_github(github, release, name, io, content_type):
|
|
@@ -235,6 +238,20 @@ def upload_io_to_github(github, release, name, io, content_type):
|
|
|
params=params, headers=headers, data=io, verify=False)
|
|
|
|
|
|
|
|
|
+def upload_sha256_checksum(version, file_path):
|
|
|
+ bucket, access_key, secret_key = s3_config()
|
|
|
+ checksum_path = '{}.sha256sum'.format(file_path)
|
|
|
+ sha256 = hashlib.sha256()
|
|
|
+ with open(file_path, 'rb') as f:
|
|
|
+ sha256.update(f.read())
|
|
|
+
|
|
|
+ filename = os.path.basename(file_path)
|
|
|
+ with open(checksum_path, 'w') as checksum:
|
|
|
+ checksum.write('{} {}'.format(sha256.hexdigest(), filename))
|
|
|
+ s3put(bucket, access_key, secret_key, os.path.dirname(checksum_path),
|
|
|
+ 'atom-shell/tmp/{0}'.format(version), [checksum_path])
|
|
|
+
|
|
|
+
|
|
|
def publish_release(github, release_id):
|
|
|
data = dict(draft=False)
|
|
|
github.repos(ELECTRON_REPO).releases(release_id).patch(data=data)
|