Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: liqoctl download fix #1971

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,16 @@

# __get_download_url returns the download URL for the given file, for the latest or the given GitHub release.
def __get_download_url(file: str) -> str:
if 'current_version' not in html_context or not __is_sem_version(html_context['current_version']):
return f"https://github.com/liqotech/liqo/releases/latest/download/{file}"
else:
return f"https://github.com/liqotech/liqo/releases/download/master/{file}"

version = generate_version()
if version == 'master':
x = requests.get('https://api.github.com/repos/liqotech/liqo/releases/latest')
version = x.json()['tag_name']
return f"https://github.com/liqotech/liqo/releases/download/{version}/{file}"

# generate_version generates the version string for the current page.
# latest: return master
# stable: return the latest release (get the last release tag from GitHub API)
# tag: return the tag specified in the html_context[github_version]
def generate_version() -> str:
version = html_context['github_version'] if 'github_version' in html_context else 'master'
if 'current_version' in html_context and html_context['current_version'] == 'stable':
Expand Down