Skip to content

Commit

Permalink
Fixed release script to not make dups
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed May 29, 2016
1 parent 0fe576b commit ac60c29
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions .ci/upload-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,21 @@ def get_target_executable_name():


def ensure_release():
resp = api_request('POST', 'repos/%s/releases' % REPO, json={
'tag_name': TAG,
'name': 'sentry-cli %s' % TAG,
'draft': True,
})
if resp.status_code != 422:
resp.raise_for_status()
release = resp.json()
log('Created new release %s' % release['id'])
return release
resp = api_request('GET', 'repos/%s/releases' % REPO)
resp.raise_for_status()
for release in resp.json():
if release['tag_name'] == TAG:
log('Found already existing release %s' % release['id'])
return release
raise RuntimeError('Could not find release %s. Too old?' % TAG)
resp = api_request('POST', 'repos/%s/releases' % REPO, json={
'tag_name': TAG,
'name': 'sentry-cli %s' % TAG,
'draft': True,
})
resp.raise_for_status()
release = resp.json()
log('Created new release %s' % release['id'])
return release


def upload_asset(release, executable, target_name):
Expand Down

0 comments on commit ac60c29

Please sign in to comment.