mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Automatically add package to release
This commit is contained in:
parent
0e914372fb
commit
ac5f95208c
@ -218,13 +218,23 @@ def release(args):
|
|||||||
|
|
||||||
# Create a release on GitHub.
|
# Create a release on GitHub.
|
||||||
fmt_repo.push('origin', 'release')
|
fmt_repo.push('origin', 'release')
|
||||||
|
params = {'access_token': os.getenv('FMT_TOKEN')}
|
||||||
r = requests.post('https://api.github.com/repos/fmtlib/fmt/releases',
|
r = requests.post('https://api.github.com/repos/fmtlib/fmt/releases',
|
||||||
params={'access_token': os.getenv('FMT_TOKEN')},
|
params=params,
|
||||||
data=json.dumps({'tag_name': version,
|
data=json.dumps({'tag_name': version,
|
||||||
'target_commitish': 'release',
|
'target_commitish': 'release',
|
||||||
'body': changes, 'draft': True}))
|
'body': changes, 'draft': True}))
|
||||||
if r.status_code != 201:
|
if r.status_code != 201:
|
||||||
raise Exception('Failed to create a release ' + str(r))
|
raise Exception('Failed to create a release ' + str(r))
|
||||||
|
id = r.json()['id']
|
||||||
|
uploads_url = 'https://uploads.github.com/repos/fmtlib/fmt/releases'
|
||||||
|
package = 'fmt-{}.zip'.format(version)
|
||||||
|
with open('build/fmt/' + package, 'rb') as f:
|
||||||
|
r = requests.post(
|
||||||
|
'{}/{}/assets?name={}'.format(uploads_url, id, package),
|
||||||
|
params=params, files={package: f})
|
||||||
|
if r.status_code != 201:
|
||||||
|
raise Exception('Failed to upload an asset ' + str(r))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user