Skip to content

Commit

Permalink
Check draft and prerelease flags to get latest stable release.
Browse files Browse the repository at this point in the history
  • Loading branch information
AngieHinrichs committed Apr 11, 2022
1 parent e530bfb commit 913b815
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pangolin/utils/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ def get_latest_release(dependency):
sys.exit(-1)

latest_release = json.load(latest_release)
latest_release_tarball = latest_release[0]['tarball_url']
try:
# Find the latest stable release
latest_release_dict = next(x for x in latest_release if not x['draft'] and not x['prerelease'])
except:
# All releases to date are prerelease or draft, just take the latest
latest_release_dict = latest_release[0]
latest_release_tarball = latest_release_dict['tarball_url']
# extract and clean up latest release version
latest_release = latest_release[0]['tag_name']
latest_release = latest_release_dict['tag_name']
print(f"Latest for {dependency} is {latest_release}")
return latest_release, latest_release_tarball


Expand Down

0 comments on commit 913b815

Please sign in to comment.