fix: ensure the versions are sorted
This commit is contained in:
1 parent
4c9deedba9
commit
344d2e83ad
2 files changed
+39
No files matched your search
@@ -105,6 +105,7 @@ main() {
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
python contrib/sort-mkdocs-versions
|
||||||
rm -rf docs
|
rm -rf docs
|
||||||
mv docs-main docs
|
mv docs-main docs
|
||||||
git checkout -- mkdocs.yml docs
|
git checkout -- mkdocs.yml docs
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
version_file = "tmp/docs-build/versions.json"
|
||||||
|
data = []
|
||||||
|
with open(version_file) as f:
|
||||||
|
data = json.load(f)
|
||||||
|
|
||||||
|
versions = []
|
||||||
|
for info in data:
|
||||||
|
if info["title"] == "latest":
|
||||||
|
continue
|
||||||
|
versions.append(info["title"].removeprefix("v"))
|
||||||
|
|
||||||
|
versions.sort(key=lambda x: list(map(int, x.split('.'))), reverse=True)
|
||||||
|
data = [
|
||||||
|
{
|
||||||
|
"aliases": [],
|
||||||
|
"title": "latest",
|
||||||
|
"version": "docs",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
for version in versions:
|
||||||
|
data.append({
|
||||||
|
"aliases": [],
|
||||||
|
"title": f"v{version}",
|
||||||
|
"version": f"docs~v{version}",
|
||||||
|
})
|
||||||
|
|
||||||
|
with open(version_file, "w") as f:
|
||||||
|
json.dump(data, f, indent=4)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in new issue
Block a user