From 9ef83549046efcb8c0911f64dc0c04b2246a1279 Mon Sep 17 00:00:00 2001 From: LE BRETON Come Date: Fri, 20 Sep 2024 16:17:24 +0200 Subject: [PATCH] Attempt to generate swticher --- .github/workflows/sphinx.yml | 3 ++- docs/source/_static/switcher.json | 2 +- docs/swticher_generator.sh | 42 +++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100755 docs/swticher_generator.sh diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index 2829f2e70..6294a84a5 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -39,7 +39,8 @@ jobs: source /builds/miniconda3/etc/profile.d/conda.sh conda activate corese-core-documentation sphinx-multiversion docs/source build/html -D 'exhale_args.containmentFolder=${sourcedir}/java_api' - cp docs/source/_static/switcher.json ./build/html + chmod u+x docs/swticher_generator.sh + ./docs/swticher_generator.sh build/html/switcher.json - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 diff --git a/docs/source/_static/switcher.json b/docs/source/_static/switcher.json index cc53f8c06..48ce0c0e6 100644 --- a/docs/source/_static/switcher.json +++ b/docs/source/_static/switcher.json @@ -8,6 +8,6 @@ { "name": "v4.5.6 (stable)", "version": "stable", - "url": "https://corese-stack.github.io/corese-core/v4.5.6/", + "url": "https://corese-stack.github.io/corese-core/v4.5.6/" } ] diff --git a/docs/swticher_generator.sh b/docs/swticher_generator.sh new file mode 100755 index 000000000..20e6270c9 --- /dev/null +++ b/docs/swticher_generator.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Get all Git tags +tags=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$') + +# Initialize an empty array to hold JSON objects +json_array=() + +# Initialize the first flag to identify the latest tag +is_first=true + +# Loop through each tag +for tag in $tags; do + # Determine if this is the latest version + if $is_first; then + preferred="true" + name="$tag (latest)" + is_first=false + else + preferred="false" + name="$tag (stable)" + fi + + # Create a JSON object for the tag + json_object=$(cat <