From 28b9dbd634fbdd3e7ff7278a657e4353cc2bad97 Mon Sep 17 00:00:00 2001
From: ambujsingh
Redirecting to latest documentation...
+|${JS_TAG}\n|" {} + + + - name: Verify build output + run: | + if [ ! -f docs_output/index.html ]; then + echo "::error::Documentation build failed - no index.html found" + exit 1 + fi + echo "Documentation built successfully" + echo "Files generated:" + find docs_output -type f | head -20 + + - name: Upload docs to release + if: startsWith(github.ref, 'refs/tags/v') + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${{ steps.version.outputs.version }}" + tar czf "docs-${VERSION}.tar.gz" -C docs_output . + gh release create "${VERSION}" --draft=false --notes "Release ${VERSION}" 2>/dev/null || true + gh release upload "${VERSION}" "docs-${VERSION}.tar.gz" --clobber + + - name: Assemble publish tree + if: github.event_name != 'pull_request' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${{ steps.version.outputs.version }}" + IS_TAG="${{ steps.version.outputs.is_tag }}" + REPO_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}" + + mkdir -p publish + + # Place current build + mkdir -p "publish/${VERSION}" + cp -a docs_output/. "publish/${VERSION}/" + + # Download previously released versions + for tag in $(gh api "repos/${{ github.repository }}/releases" --paginate --jq '.[].tag_name' | grep '^v'); do + if [ "${tag}" = "${VERSION}" ]; then + continue + fi + if gh release download "${tag}" --pattern "docs-${tag}.tar.gz" --dir /tmp 2>/dev/null; then + mkdir -p "publish/${tag}" + tar xzf "/tmp/docs-${tag}.tar.gz" -C "publish/${tag}" + rm -f "/tmp/docs-${tag}.tar.gz" + echo "Restored ${tag} from release artifact" + else + echo "::warning::No docs artifact found for release ${tag}" + fi + done + + # stable = newest tagged version that has docs + if [[ "${IS_TAG}" == "true" ]]; then + rm -rf publish/stable + cp -a docs_output/. publish/stable/ + else + NEWEST_TAG=$(find publish -maxdepth 1 -mindepth 1 -type d -name "v*" -printf '%f\n' | sort -rV | head -1) + if [ -n "${NEWEST_TAG}" ]; then + rm -rf publish/stable + cp -a "publish/${NEWEST_TAG}/." publish/stable/ + fi + fi + + # Shared assets + mkdir -p publish/_shared/css publish/_shared/js + cp docs/sphinx/_static/css/version_flyout.css publish/_shared/css/ + cp docs/sphinx/_static/js/version_flyout.js publish/_shared/js/ + + # Root index and Jekyll bypass + cp docs/sphinx/_gh_pages/index.html publish/index.html + touch publish/.nojekyll + + # Generate switcher.json from actual directory contents + echo "[" > publish/switcher.json + echo " {\"name\": \"latest\", \"version\": \"latest\", \"url\": \"${REPO_URL}/latest/\"}," >> publish/switcher.json + + if [ -d "publish/stable" ]; then + echo " {\"name\": \"stable\", \"version\": \"stable\", \"url\": \"${REPO_URL}/stable/\", \"preferred\": true}," >> publish/switcher.json + fi + + for dir in $(find publish -maxdepth 1 -mindepth 1 -type d -name "v*" | sort -rV); do + ver=$(basename "$dir") + echo " {\"name\": \"${ver}\", \"version\": \"${ver}\", \"url\": \"${REPO_URL}/${ver}/\"}," >> publish/switcher.json + done + + sed -i '$ s/,$//' publish/switcher.json + echo "]" >> publish/switcher.json + + - name: Upload Pages artifact + if: github.event_name != 'pull_request' + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 + with: + path: publish + + - name: Print preview URL + if: github.event_name != 'pull_request' + run: | + REPO_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}" + echo "::notice::Documentation deployed to: ${REPO_URL}/${{ steps.version.outputs.version }}/" + + deploy-pages: + needs: build-docs + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 diff --git a/docs/sphinx/_gh_pages/index.html b/docs/sphinx/_gh_pages/index.html new file mode 100644 index 000000000..95695270a --- /dev/null +++ b/docs/sphinx/_gh_pages/index.html @@ -0,0 +1,12 @@ + + +
+ +
+ + + +
+