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

Separate header source for components for updates #500

Merged
merged 7 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions src/rocm_docs/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import fastjsonschema # type: ignore[import-untyped]
import github
import requests
import sphinx.util.logging
import yaml
from pydata_sphinx_theme.utils import ( # type: ignore[import-untyped]
Expand Down Expand Up @@ -329,9 +330,13 @@ def _update_theme_configs(
app: Sphinx, current_project: _Project | None, current_branch: str
) -> None:
"""Update configurations for use in theme.py"""
latest_version = "6.0.0"
latest_version = requests.get(
"https://raw.githubusercontent.com/RadeonOpenCompute/rocm-docs-core/header-versions/latest_version.txt"
).text
latest_version_string = f"docs-{latest_version}"
release_candidate = "6.1.0"
release_candidate = requests.get(
"https://raw.githubusercontent.com/RadeonOpenCompute/rocm-docs-core/header-versions/release_candidate.txt"
).text
release_candidate_string = f"docs-{release_candidate}"

development_branch = _Project.default_value("development_branch")
Expand Down
2 changes: 1 addition & 1 deletion src/rocm_docs/rocm_docs_theme/sections/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<img src="{{ pathto('_static/images/amd-header-logo.svg',1) }}" alt="AMD Logo" title="AMD Logo" width="90" class="d-inline-block align-text-top hover-opacity"/>
</a>
<div class="vr vr mx-40 my-25"></div>
{{ top_level_header(theme_repository_branch | replace("docs-", ""), theme_header_latest_version, theme_header_release_candidate) }}
{{ top_level_header(theme_repository_branch | replace("docs-", ""), theme_header_latest_version, theme_header_release_candidate_version) }}
<a class="header-all-versions" href="https://rocm.docs.amd.com/en/latest/release/versions.html">Version List</a>
</div>
<div class="icon-nav text-center d-flex ms-auto">
Expand Down
2 changes: 1 addition & 1 deletion src/rocm_docs/rocm_docs_theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ flavor = rocm
link_main_doc = True

header_latest_version = 6.0.0
header_release_candidate = 6.1.0
header_release_candidate_version = 6.1.0
12 changes: 12 additions & 0 deletions src/rocm_docs/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from pathlib import Path

import requests
import sphinx.util.logging
from pydata_sphinx_theme.utils import ( # type: ignore[import-untyped]
config_provided_by_user,
Expand Down Expand Up @@ -89,11 +90,22 @@ def _update_theme_options(app: Sphinx) -> None:
0, "components/left-side-menu"
)

header_latest_version = requests.get(
"https://raw.githubusercontent.com/RadeonOpenCompute/rocm-docs-core/header-versions/latest_version.txt"
).text
header_release_candidate_version = requests.get(
"https://raw.githubusercontent.com/RadeonOpenCompute/rocm-docs-core/header-versions/release_candidate.txt"
).text

default_config_opts = {
"html_show_sphinx": False,
"html_favicon": "https://www.amd.com/themes/custom/amd/favicon.ico",
"notfound_context": {"title": "404 - Page Not Found"},
"notfound_template": "404.html",
"html_context": {
"theme_header_latest_version": header_latest_version,
"theme_header_release_candidate_version": header_release_candidate_version,
},
}
for key, default in default_config_opts.items():
if not config_provided_by_user(app, key):
Expand Down