Skip to content

Commit 6971a2f

Browse files
cheina97adamjensenbot
authored andcommitted
Docs: liqoctl download fix
1 parent e21d5ce commit 6971a2f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

docs/conf.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,16 @@
101101

102102
# __get_download_url returns the download URL for the given file, for the latest or the given GitHub release.
103103
def __get_download_url(file: str) -> str:
104-
if 'current_version' not in html_context or not __is_sem_version(html_context['current_version']):
105-
return f"https://github.com/liqotech/liqo/releases/latest/download/{file}"
106-
else:
107-
return f"https://github.com/liqotech/liqo/releases/download/master/{file}"
108-
104+
version = generate_version()
105+
if version == 'master':
106+
x = requests.get('https://api.github.com/repos/liqotech/liqo/releases/latest')
107+
version = x.json()['tag_name']
108+
return f"https://github.com/liqotech/liqo/releases/download/{version}/{file}"
109+
109110
# generate_version generates the version string for the current page.
111+
# latest: return master
112+
# stable: return the latest release (get the last release tag from GitHub API)
113+
# tag: return the tag specified in the html_context[github_version]
110114
def generate_version() -> str:
111115
version = html_context['github_version'] if 'github_version' in html_context else 'master'
112116
if 'current_version' in html_context and html_context['current_version'] == 'stable':

0 commit comments

Comments
 (0)