-
Notifications
You must be signed in to change notification settings - Fork 2
/
githubhelper.py
27 lines (22 loc) · 908 Bytes
/
githubhelper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import json, urllib, sys, os, subprocess
from tokenkeys import oauth_token
VERSION = sys.argv[1]
fn = 'pkg/https-everywhere-%s.crx' % VERSION
results = json.load(urllib.urlopen('https://api.github.com/repos/aaronsw/https-everywhere/downloads?access_token=%s' % oauth_token, json.dumps(dict(
name=fn.split('/')[-1],
size=os.stat(fn).st_size,
description='Release of version %s' % VERSION,
content_type='application/x-chrome-extension'
))))
subprocess.Popen(['curl',
'-F', 'key=%s' % results['path'],
'-F', "acl=%s" % results['acl'],
'-F', "success_action_status=201",
'-F', "Filename=%s" % results['name'],
'-F', "AWSAccessKeyId=%s" % results['accesskeyid'],
'-F', "Policy=%s" % results['policy'],
'-F', "Signature=%s" % results['signature'],
'-F', "Content-Type=%s" % results['mime_type'],
'-F', "file=@%s" % fn,
'https://github.s3.amazonaws.com/']).wait()
print '\nUploaded.'