name: Documentation on: release: types: [published] permissions: contents: write jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Install uv uses: astral-sh/setup-uv@v7 - name: Set up Python run: uv python install 3.13 - run: uv sync --group dev - name: Configure git run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - name: Deploy documentation run: | VERSION=${GITHUB_REF_NAME#v} MAJOR=$(echo "$VERSION" | cut -d. -f1) DEPLOY_VERSION="v$(echo "$VERSION" | cut -d. -f1-2)" # 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=$(echo "$OLD_FEATURE_VERSIONS" | sort -t. -k2 -n | tail -1) echo "$OLD_FEATURE_VERSIONS" | while read -r OLD_V; do if [ "$OLD_V" != "$LATEST_PREV" ]; then echo "Deleting $OLD_V" uv run mike delete "$OLD_V" fi done fi uv run mike deploy --update-aliases "$DEPLOY_VERSION" stable uv run mike set-default stable git push origin gh-pages