diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2019-01-13 18:13:29 +0100 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2019-01-13 18:13:29 +0100 |
commit | cfd6ae88b194d69d2a2c365d4a8a78644ba9079b (patch) | |
tree | 55fb550e78ee4da583a484f1129e798cce88e0dd /scripts/gh-push.py | |
parent | d49cde5d0b948f24aa7b3bd9ad9b3b63333f2281 (diff) |
added github AUTO deploy scripts
Diffstat (limited to 'scripts/gh-push.py')
-rw-r--r-- | scripts/gh-push.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/gh-push.py b/scripts/gh-push.py new file mode 100644 index 0000000..3aedb15 --- /dev/null +++ b/scripts/gh-push.py @@ -0,0 +1,30 @@ +import sys, re +from gh import gh, get_release + +if len(sys.argv) != 2: + print("Usage: python gh-push.py FILENAME") + sys.exit(1) + +f = sys.argv[1] + +print('Pulling info on release AUTO.') +draft = get_release('AUTO') + +existing = [a for a in draft['assets'] if a['name'] == f] +if (len(existing) > 0): + print('Asset exists, deleting.') + gh('releases/assets/' + str(existing[0]['id']), + ['-X', 'DELETE']) + +print('Uploading new asset...') + +upload_url = re.sub( + '\\{.*\\}', '?name=' + f, + draft['upload_url']) + +resp = gh(upload_url, [ + '-H', 'Content-type: application/octet-stream', + '--data-binary', f + ]) + +print('Done.') |