Commit 515cef87 authored by Aleks Kissinger's avatar Aleks Kissinger

fixed curl invokation in github scripts

parent 0efa4c0d
#!/usr/bin/env python
from gh import gh, pr from gh import gh, pr
import os import os
tok = os.getenv('GITHUB_TOKEN') tok = os.getenv('GITHUB_TOKEN')
draft = [r for r in gh('releases') draft = [r for r in gh('releases') if r['draft']][0]
if r['draft'] and r['name'] == 'AUTO'][0]
for a in draft['assets']: for a in draft['assets']:
print(a['browser_download_url'] + print(a['browser_download_url'] +
......
import sys, re #!/usr/bin/env python
from gh import gh, get_release
import sys, os, re
from gh import gh
if len(sys.argv) != 2: if len(sys.argv) != 2:
print("Usage: python gh-push.py FILENAME") print("Usage: python gh-push.py FILENAME")
sys.exit(1) sys.exit(1)
f = sys.argv[1] f = sys.argv[1]
fname = os.path.basename(f)
print('Pulling info on release AUTO.') print('Pulling info on draft release...')
draft = get_release('AUTO') draft = [r for r in gh('releases') if r['draft']][0]
print('Found: ' + draft['name'])
existing = [a for a in draft['assets'] if a['name'] == f] existing = [a for a in draft['assets'] if a['name'] == fname]
if (len(existing) > 0): if (len(existing) > 0):
print('Asset exists, deleting.') print('Asset %s exists, deleting.' % fname)
gh('releases/assets/' + str(existing[0]['id']), gh('releases/assets/' + str(existing[0]['id']),
['-X', 'DELETE']) ['-X', 'DELETE'])
print('Uploading new asset...') print('Uploading %s...' % f)
upload_url = re.sub( upload_url = re.sub(
'\\{.*\\}', '?name=' + f, '\\{.*\\}', '?name=' + fname,
draft['upload_url']) draft['upload_url'])
resp = gh(upload_url, [ resp = gh(upload_url, [
'-H', 'Content-type: application/octet-stream', '-H', 'Content-type: application/octet-stream',
'--data-binary', f '--data-binary', '@' + f
]) ])
print('Done.') print('Done.')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment