Compare commits

...
7 changed files with 54 additions and 17 deletions

No files matched your search

+1 -1
View File
@@ -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
View File
@@ -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": {
+1
View File
@@ -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
+1
View File
@@ -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.
+48 -13
View File
@@ -4,6 +4,7 @@ import json
import logging
import os
import platform
import random
import re
import subprocess
import sys
@@ -33,21 +34,21 @@ def main(args=None):
auth = github.Github(gh_token)
app_repo = auth.get_repo('lbryio/lbry-app')
# TODO: switch lbryio/lbrynet-daemon to lbryio/lbry
daemon_repo = auth.get_repo('lbryio/lbrynet-daemon')
daemon_repo = auth.get_repo('lbryio/lbry')
if not check_repo_has_tag(app_repo, current_tag):
log.info('Tag %s is not in repo %s', current_tag, app_repo)
# 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,64 @@ 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
while count < 10:
try:
return _upload_asset(release, asset_to_upload, token, _curl_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
)
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'])
# requests doesn't work on windows / linux / osx.
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):