Change GitHub upload to use JS GitHub lib
Needed for Appveyor when running releases
This commit is contained in:
parent
ec587032b2
commit
cb7f8e256e
3 changed files with 37 additions and 13 deletions
|
@ -67,7 +67,7 @@ def main():
|
|||
run_python_script('upload-index-json.py')
|
||||
|
||||
# Create and upload the Electron SHASUMS*.txt
|
||||
release_electron_checksums(github, release)
|
||||
release_electron_checksums(release)
|
||||
|
||||
# Press the publish button.
|
||||
publish_release(github, release['id'])
|
||||
|
@ -198,11 +198,14 @@ def create_release_draft(github, tag):
|
|||
return r
|
||||
|
||||
|
||||
def release_electron_checksums(github, release):
|
||||
def release_electron_checksums(release):
|
||||
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')
|
||||
filename = 'SHASUMS256.txt'
|
||||
filepath = os.path.join(SOURCE_ROOT, filename)
|
||||
with open(filepath, 'w') as sha_file:
|
||||
sha_file.write(checksums.decode('utf-8'))
|
||||
upload_io_to_github(release, filename, filepath)
|
||||
|
||||
|
||||
def upload_electron(github, release, file_path):
|
||||
|
@ -217,8 +220,7 @@ def upload_electron(github, release, file_path):
|
|||
pass
|
||||
|
||||
# Upload the file.
|
||||
with open(file_path, 'rb') as f:
|
||||
upload_io_to_github(github, release, filename, f, 'application/zip')
|
||||
upload_io_to_github(release, filename, file_path)
|
||||
|
||||
# Upload the checksum file.
|
||||
upload_sha256_checksum(release['tag_name'], file_path)
|
||||
|
@ -232,11 +234,11 @@ def upload_electron(github, release, file_path):
|
|||
upload_electron(github, release, arm_file_path)
|
||||
|
||||
|
||||
def upload_io_to_github(github, release, name, io, content_type):
|
||||
params = {'name': name}
|
||||
headers = {'Content-Type': content_type}
|
||||
github.repos(ELECTRON_REPO).releases(release['id']).assets.post(
|
||||
params=params, headers=headers, data=io, verify=False)
|
||||
def upload_io_to_github(release, filename, filepath):
|
||||
print 'Uploading %s to Github' % \
|
||||
(filename)
|
||||
script_path = os.path.join(SOURCE_ROOT, 'script', 'upload-to-github.js')
|
||||
execute(['node', script_path, filepath, filename, str(release['id'])])
|
||||
|
||||
|
||||
def upload_sha256_checksum(version, file_path):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue