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
import os
tok = os.getenv('GITHUB_TOKEN')
draft = [r for r in gh('releases')
if r['draft'] and r['name'] == 'AUTO'][0]
draft = [r for r in gh('releases') if r['draft']][0]
for a in draft['assets']:
print(a['browser_download_url'] +
......
import sys, re
from gh import gh, get_release
#!/usr/bin/env python
import sys, os, re
from gh import gh
if len(sys.argv) != 2:
print("Usage: python gh-push.py FILENAME")
sys.exit(1)
f = sys.argv[1]
fname = os.path.basename(f)
print('Pulling info on release AUTO.')
draft = get_release('AUTO')
print('Pulling info on draft release...')
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):
print('Asset exists, deleting.')
print('Asset %s exists, deleting.' % fname)
gh('releases/assets/' + str(existing[0]['id']),
['-X', 'DELETE'])
print('Uploading new asset...')
print('Uploading %s...' % f)
upload_url = re.sub(
'\\{.*\\}', '?name=' + f,
'\\{.*\\}', '?name=' + fname,
draft['upload_url'])
resp = gh(upload_url, [
'-H', 'Content-type: application/octet-stream',
'--data-binary', f
'--data-binary', '@' + f
])
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