Skip to content

Commit

Permalink
build: github_releases can update older releases, and pauses to get t…
Browse files Browse the repository at this point in the history
…he sorting right
  • Loading branch information
nedbat committed Oct 14, 2024
1 parent ca550ca commit fb2b49f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ci/github_releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import shlex
import subprocess
import sys
import time

import pkg_resources
import requests
Expand Down Expand Up @@ -94,12 +95,12 @@ def get_releases(session, repo):
:arrow_right:\xa0 To install: `python3 -m pip install coverage=={version}`
"""

def release_for_relnote(relnote):
def release_for_relnote(relnote, tag):
"""
Turn a release note dict into the data needed by GitHub for a release.
"""
relnote_text = relnote["text"]
tag = version = relnote["version"]
version = relnote["version"]
body = RELEASE_BODY_FMT.format(
relnote_text=relnote_text,
version=version,
Expand Down Expand Up @@ -148,16 +149,20 @@ def update_github_releases(json_filename, repo):
for relnote in relnotes:
tag = relnote["version"]
if not does_tag_exist(tag):
continue
release_data = release_for_relnote(relnote)
tag = f"coverage-{tag}"
if not does_tag_exist(tag):
continue
release_data = release_for_relnote(relnote, tag)
exists = tag in releases
if not exists:
create_release(gh_session, repo, release_data)
time.sleep(3)
else:
release = releases[tag]
if release["body"] != release_data["body"]:
url = release["url"]
update_release(gh_session, url, release_data)
time.sleep(3)

if __name__ == "__main__":
update_github_releases(*sys.argv[1:3])

0 comments on commit fb2b49f

Please sign in to comment.