Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
update-releases: Multi file release
Browse files Browse the repository at this point in the history
  • Loading branch information
iakat committed Nov 9, 2024
1 parent d052f90 commit f4af7dd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions update-releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# with pagination!
def get_releases(repo):
releases = []
url = f"https://api.github.com/repos/{repo}/releases"
url = f"v/{repo}/releases"
while True:
r = requests.get(url)
r.raise_for_status()
Expand Down Expand Up @@ -70,7 +70,7 @@ def get_releases(repo):
assets_size = 0
for asset in release["assets"]:
# check if it is a .tar file
if asset["name"].endswith(".tar"):
if asset["name"].contains(".tar"):
assets_size += asset["size"]
assets = f"{assets_size // 1024 // 1024} MB"
CURRENT_SIZE += assets_size
Expand All @@ -80,12 +80,14 @@ def get_releases(repo):
releases_per_day[date].append((pod_name, assets))
# Add to preferred_releases_per_day if it is bigger than the current one
# example:
link = f"https://github.com/{REPO}/releases/download/v{date_with_dots}-{pod_name}/v{date_with_dots}-{pod_name}.tar"
#link = f"https://github.com/{REPO}/releases/download/v{date_with_dots}-{pod_name}/v{date_with_dots}-{pod_name}.tar"
# links should be from release.assets.0.browser_download_url, conctenated by string
links = ",".join([asset["browser_download_url"] for asset in release["assets"]])
if date not in preferred_releases_per_day:
preferred_releases_per_day[date] = (link, assets_size)
preferred_releases_per_day[date] = (links, assets_size)
else:
if assets_size > preferred_releases_per_day[date][1]:
preferred_releases_per_day[date] = (link, assets_size)
preferred_releases_per_day[date] = (links, assets_size)


# Make header
Expand Down

0 comments on commit f4af7dd

Please sign in to comment.