Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
318160b328 | ||
|
|
478ca98b0e | ||
|
|
2e8c8b95c8 | ||
|
|
6fb83f8da4 | ||
|
|
26c077dd79 | ||
|
|
be97368123 | ||
|
|
a11949608a | ||
|
|
26391cb935 | ||
|
|
4688e92aab | ||
|
|
498534a61e | ||
|
|
01e19a457b | ||
|
|
105f234d2c | ||
|
|
18cd7608e3 | ||
|
|
9e7ca7c9f8 | ||
|
|
0c77644861 |
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 0.9.0rc9
|
||||
current_version = 0.9.0rc10
|
||||
commit = True
|
||||
tag = True
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+)(?P<candidate>\d+))?
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "LBRY",
|
||||
"version": "0.9.0rc9",
|
||||
"version": "0.9.0rc10",
|
||||
"main": "main.js",
|
||||
"description": "LBRY is a fully decentralized, open-source protocol facilitating the discovery, access, and (sometimes) purchase of data.",
|
||||
"author": {
|
||||
|
||||
@@ -41,6 +41,7 @@ build_script:
|
||||
- python zip_daemon.py
|
||||
- dir dist
|
||||
- pip install PyGithub uritemplate
|
||||
- pip install -U requests[security]
|
||||
- python release_on_tag.py
|
||||
|
||||
test: off
|
||||
|
||||
@@ -84,6 +84,7 @@ if [ "$FULL_BUILD" == "true" ]; then
|
||||
# it to reliably work and it also seemed difficult to configure. Not proud of
|
||||
# this, but it seemed better to write my own.
|
||||
pip install PyGithub uritemplate
|
||||
pip install -U requests[security]
|
||||
python release_on_tag.py
|
||||
deactivate
|
||||
fi
|
||||
+1
-1
Submodule lbry updated: 40d4fb5641...d3d8426430.
+1
-1
Submodule lbry-web-ui updated: 75cf359e6f...9a36270d3e.
+49
-12
@@ -4,6 +4,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import random
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -40,14 +41,14 @@ def main(args=None):
|
||||
# TODO: maybe this should be an error
|
||||
return
|
||||
|
||||
app = get_app_artifact()
|
||||
release = get_release(app_repo, current_tag)
|
||||
upload_asset(release, app, gh_token)
|
||||
|
||||
daemon = get_daemon_artifact()
|
||||
release = get_release(daemon_repo, current_tag)
|
||||
upload_asset(release, daemon, gh_token)
|
||||
|
||||
app = get_app_artifact()
|
||||
release = get_release(app_repo, current_tag)
|
||||
upload_asset(release, app, gh_token)
|
||||
|
||||
|
||||
def check_repo_has_tag(repo, target_tag):
|
||||
tags = repo.get_tags().get_page(0)
|
||||
@@ -84,30 +85,66 @@ def upload_asset(release, asset_to_upload, token):
|
||||
basename = os.path.basename(asset_to_upload)
|
||||
if is_asset_already_uploaded(release, basename):
|
||||
return
|
||||
count = 0
|
||||
uploaders = [_requests_uploader, _curl_uploader]
|
||||
while count < 10:
|
||||
uploader = uploaders[count % len(uploaders)]
|
||||
try:
|
||||
return _upload_asset(release, asset_to_upload, token, uploader)
|
||||
except Exception:
|
||||
log.exception('Failed to upload')
|
||||
count += 1
|
||||
|
||||
|
||||
def _upload_asset(release, asset_to_upload, token, uploader):
|
||||
basename = os.path.basename(asset_to_upload)
|
||||
upload_uri = uritemplate.expand(
|
||||
release.upload_url, {'name': basename})
|
||||
release.upload_url,
|
||||
{'name': ''.join([random.choice('abcdef') for _ in range(10)])}
|
||||
)
|
||||
output = uploader(upload_uri, asset_to_upload, token)
|
||||
if 'errors' in output:
|
||||
raise Exception(output)
|
||||
else:
|
||||
log.info('Successfully uploaded to %s', output['browser_download_url'])
|
||||
|
||||
|
||||
def _requests_uploader(upload_uri, asset_to_upload, token):
|
||||
log.info('Using requests to upload %s to %s', asset_to_upload, upload_uri)
|
||||
with open(asset_to_upload, 'rb') as f:
|
||||
response = requests.post(upload_uri, data=f, auth=('', token))
|
||||
output = response.json()
|
||||
return output
|
||||
|
||||
|
||||
def _curl_uploader(upload_uri, asset_to_upload, token):
|
||||
# using requests.post fails miserably with SSL EPIPE errors. I spent
|
||||
# half a day trying to debug before deciding to switch to curl.
|
||||
#
|
||||
# TODO: actually set the content type
|
||||
log.info('Using curl to upload %s to %s', asset_to_upload, upload_uri)
|
||||
cmd = [
|
||||
'curl', '-sS', '-X', 'POST', '-u', ':{}'.format(os.environ['GH_TOKEN']),
|
||||
'curl',
|
||||
'-sS',
|
||||
'-X', 'POST',
|
||||
'-u', ':{}'.format(os.environ['GH_TOKEN']),
|
||||
'--header', 'Content-Type:application/octet-stream',
|
||||
'--data-binary', '@{}'.format(asset_to_upload), upload_uri
|
||||
'--data-binary', str('@{}'.format(asset_to_upload)),
|
||||
str(upload_uri)
|
||||
]
|
||||
print 'Calling curl:'
|
||||
print cmd
|
||||
print
|
||||
p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
print 'curl return code:', p.returncode
|
||||
if stderr:
|
||||
print 'stderr output from curl:'
|
||||
print stderr
|
||||
output = json.loads(stdout)
|
||||
print 'stdout from curl:'
|
||||
print stdout
|
||||
if 'errors' in output:
|
||||
raise Exception(output)
|
||||
else:
|
||||
log.info('Successfully uploaded to %s', output['browser_download_url'])
|
||||
output = json.loads(stdout)
|
||||
return output
|
||||
|
||||
|
||||
def is_asset_already_uploaded(release, basename):
|
||||
|
||||
Reference in new issue
Block a user