From ab125c6ea19bb90d88ae9f63d5c798fe3ae4e0ff Mon Sep 17 00:00:00 2001 From: d3vyce <44915747+d3vyce@users.noreply.github.com> Date: Fri, 3 Apr 2026 11:43:36 +0200 Subject: [PATCH] docs: rework versioning to keep latest feature version per major (#223) --- .github/workflows/docs.yml | 21 ++++++--------------- zensical.toml | 7 ++++++- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 78927fb..3fc2bed 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -34,26 +34,17 @@ jobs: MAJOR=$(echo "$VERSION" | cut -d. -f1) DEPLOY_VERSION="v$(echo "$VERSION" | cut -d. -f1-2)" - # On new major: consolidate previous major's feature versions into vX + # On new major: keep only the latest feature version of the previous major PREV_MAJOR=$((MAJOR - 1)) OLD_FEATURE_VERSIONS=$(uv run mike list 2>/dev/null | grep -oE "^v${PREV_MAJOR}\.[0-9]+" || true) if [ -n "$OLD_FEATURE_VERSIONS" ]; then - LATEST_PREV_TAG=$(git tag -l "v${PREV_MAJOR}.*" | sort -V | tail -1) - - if [ -n "$LATEST_PREV_TAG" ]; then - git checkout "$LATEST_PREV_TAG" -- docs/ docs_src/ src/ zensical.toml - if ! grep -q '\[project\.extra\.version\]' zensical.toml; then - printf '\n[project.extra.version]\nprovider = "mike"\ndefault = "stable"\nalias = true\n' >> zensical.toml - fi - uv run mike deploy "v${PREV_MAJOR}" - git checkout HEAD -- docs/ docs_src/ src/ zensical.toml - fi - - # Delete old feature versions + LATEST_PREV=$(echo "$OLD_FEATURE_VERSIONS" | sort -t. -k2 -n | tail -1) echo "$OLD_FEATURE_VERSIONS" | while read -r OLD_V; do - echo "Deleting $OLD_V" - uv run mike delete "$OLD_V" + if [ "$OLD_V" != "$LATEST_PREV" ]; then + echo "Deleting $OLD_V" + uv run mike delete "$OLD_V" + fi done fi diff --git a/zensical.toml b/zensical.toml index c884a3d..c5f2816 100644 --- a/zensical.toml +++ b/zensical.toml @@ -2,10 +2,15 @@ site_name = "FastAPI Toolsets" site_description = "Production-ready utilities for FastAPI applications." site_author = "d3vyce" -site_url = "https://fastapi-toolsets.d3vyce.fr" +site_url = "https://fastapi-toolsets.d3vyce.fr/" copyright = "Copyright © 2026 d3vyce" repo_url = "https://github.com/d3vyce/fastapi-toolsets" +[project.extra.version] +provider = "mike" +default = "stable" +alias = true + [project.theme] custom_dir = "docs/overrides" language = "en"