fix(docs): Repair documentation deployment workflow and makefile #8
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Documentation | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| pull_request: | |
| branches: [ master, main ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-docs: | |
| name: Build Documentation | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Swift | |
| uses: swift-actions/setup-swift@v2 | |
| with: | |
| swift-version: "6.1" | |
| - name: Build Documentation | |
| run: make docs-generate REPO_NAME=math DOCS_VERSION_PATH=main | |
| - name: Add Root Redirect | |
| run: | | |
| cat <<EOF > .build/documentation/index.html | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Redirecting to Documentation</title> | |
| <link rel="canonical" href="main/documentation/fireblademath/index.html"> | |
| <script> | |
| window.location.href = "main/documentation/fireblademath/index.html" + window.location.hash; | |
| </script> | |
| <meta http-equiv="refresh" content="0;url=main/documentation/fireblademath/index.html"> | |
| </head> | |
| <body> | |
| <p>Redirecting to <a href="main/documentation/fireblademath/index.html">documentation</a>...</p> | |
| </body> | |
| </html> | |
| EOF | |
| - name: Check Documentation Quality | |
| run: | | |
| make docs-check-coverage | |
| make docs-check-links | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: .build/documentation | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: build-docs | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' | |
| 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@v4 | |
| smoke-test: | |
| name: Post-Deployment Smoke Test | |
| needs: deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check Documentation URL | |
| run: | | |
| # Wait a few seconds for CDN propagation | |
| sleep 10 | |
| # Verify the versioned documentation path exists | |
| curl --fail -sL https://fireblade-engine.github.io/math/main/documentation/fireblademath/ | grep -q "FirebladeMath" | |
| echo "Documentation is live at /math/main/" | |
| - name: Check Root Redirect | |
| run: | | |
| # Verify that the root URL redirects correctly | |
| RESPONSE=$(curl -sI https://fireblade-engine.github.io/math/ | head -n 1) | |
| # Note: GitHub Pages might return 200 with the redirect meta tag, or a 301/302 if configured at the DNS level. | |
| # Since we use a meta/JS redirect, we check for a 200 OK and then the content. | |
| curl -s https://fireblade-engine.github.io/math/ | grep -q "Redirecting to" | |
| echo "Root redirect is live at /math/" |