summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleks Kissinger <aleks0@gmail.com>2019-01-14 08:16:09 +0100
committerAleks Kissinger <aleks0@gmail.com>2019-01-14 08:16:09 +0100
commit515cef87a1b676ad09b1fc2243815ffe3310b221 (patch)
tree8872c7b4d0a9a977d2b53949013cde2c2ef461c5
parent0efa4c0d62e07c0864ab1d88fbc545f769698044 (diff)
fixed curl invokation in github scripts
-rw-r--r--scripts/gh-list.py5
-rw-r--r--scripts/gh-push.py22
2 files changed, 16 insertions, 11 deletions
diff --git a/scripts/gh-list.py b/scripts/gh-list.py
index 1966db4..f8b1c91 100644
--- a/scripts/gh-list.py
+++ b/scripts/gh-list.py
@@ -1,10 +1,11 @@
+#!/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'] +
diff --git a/scripts/gh-push.py b/scripts/gh-push.py
index 3aedb15..dd3b940 100644
--- a/scripts/gh-push.py
+++ b/scripts/gh-push.py
@@ -1,30 +1,34 @@
-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.')