Skip to content

Commit

Permalink
docs: Fix version warning banner
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Jan 10, 2025
1 parent 7e03c9c commit e75d0a6
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,34 @@ jobs:
import json
url = os.environ["URL"]
current = os.environ["CURRENT"]
version = os.environ["SPHINX_VERSION"]
release = os.environ["SPHINX_RELEASE"]
# Retrieve history
response = requests.get(f"{url}/versions.json")
response.raise_for_status()
history = set(map(operator.itemgetter("version"), response.json())) - {"dev"} | {current}
history = sorted(history, key=lambda x: float(x), reverse=True)[:10]
history = {version["name"]: version["version"] for version in response.json()}
# Add new version to history
history[version] = release
# Sort history to keep only the latest versions
history = sorted(
history.items(),
key=lambda item: float(item[0]) if item[0] != "dev" else float('inf'),
reverse=True
)
# Rewrite the history
new = [
{
"name": version,
"version": version,
"version": release,
"url": f"{url}/{version}/",
"preferred": i == 1,
}
for i, version in enumerate(["dev"] + history)
for i, (version, release) in enumerate(history[:11])
]
os.mkdir("artifacts")
Expand All @@ -179,7 +191,8 @@ jobs:
)
env:
URL: ${{ vars.DOCUMENTATION_URL }}
CURRENT: ${{ needs.sphinx-version.outputs.SPHINX_VERSION }}
SPHINX_VERSION: ${{ needs.sphinx-version.outputs.SPHINX_VERSION }}
SPHINX_RELEASE: ${{ needs.sphinx-version.outputs.SPHINX_RELEASE }}
- uses: ./.github/actions/sphinx/deploy
with:
CONFIGURATION: ${{ secrets.RCLONE_CONFIG_DOCS }}
Expand Down

0 comments on commit e75d0a6

Please sign in to comment.