From f97607cc15870b71a6cc2d256b6041c07c2049c6 Mon Sep 17 00:00:00 2001 From: mhostetter Date: Sun, 19 Nov 2023 20:58:19 -0500 Subject: [PATCH] Fix doc version sorting --- .github/workflows/docs.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 3eb917ddf..fd80d977f 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -120,6 +120,7 @@ jobs: - name: Update versions.json file shell: python run: | + from distutils.version import StrictVersion import json import pathlib import os @@ -133,6 +134,13 @@ jobs: versions.remove("latest") os.system("rm latest") + # Sort versions, ignoring the initial 'v' + def sort_version(version): + if "x" in version: + version = version.replace("x", "1000") + return StrictVersion(version[1:]) + versions = sorted(versions, key=sort_version, reverse=True) + list_of_dicts = [] latest = None for version in versions: