Skip to content

Commit 9b85371

Browse files
authored
fix(docs): Repair documentation deployment workflow and makefile (#37)
* build(docs): Update Makefile to support versioned documentation paths * docs: Add root redirect for GitHub Pages * conductor(checkpoint): Checkpoint end of Phase 1 * ci: Inject versioned path in documentation build * ci: Verify upload path in documentation workflow * ci: Copy root redirect to documentation output * docs: Remove static redirect file in favor of dynamic generation * ci: Generate root redirect index.html dynamically * ci: Add post-deployment smoke tests * ci: Run documentation check on PRs (no deploy) * ci: Explicitly point root redirect to index.html for DocC compatibility * fix(docs): Ensure output directory exists for documentation generation * Revert "ci: Explicitly point root redirect to index.html for DocC compatibility" This reverts commit f6bb9bb. * ci: Explicitly point root redirect to index.html for DocC compatibility * fix(docs): Ensure output directory exists for documentation generation * fix(ci): Ensure docs output directory exists before generation * fix(ci): Use tabs in Makefile for docs-generate target
1 parent b874ac2 commit 9b85371

File tree

2 files changed

+58
-4
lines changed

2 files changed

+58
-4
lines changed

.github/workflows/docs.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ name: Documentation
33
on:
44
push:
55
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
68
workflow_dispatch:
79

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
814
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
915
permissions:
1016
contents: read
@@ -25,7 +31,27 @@ jobs:
2531
swift-version: "6.1"
2632

2733
- name: Build Documentation
28-
run: make docs-generate
34+
run: make docs-generate REPO_NAME=math DOCS_VERSION_PATH=main
35+
36+
- name: Add Root Redirect
37+
run: |
38+
cat <<EOF > .build/documentation/index.html
39+
<!DOCTYPE html>
40+
<html>
41+
<head>
42+
<meta charset="utf-8">
43+
<title>Redirecting to Documentation</title>
44+
<link rel="canonical" href="main/documentation/fireblademath/index.html">
45+
<script>
46+
window.location.href = "main/documentation/fireblademath/index.html" + window.location.hash;
47+
</script>
48+
<meta http-equiv="refresh" content="0;url=main/documentation/fireblademath/index.html">
49+
</head>
50+
<body>
51+
<p>Redirecting to <a href="main/documentation/fireblademath/index.html">documentation</a>...</p>
52+
</body>
53+
</html>
54+
EOF
2955
3056
- name: Check Documentation Quality
3157
run: |
@@ -49,3 +75,25 @@ jobs:
4975
- name: Deploy to GitHub Pages
5076
id: deployment
5177
uses: actions/deploy-pages@v4
78+
79+
smoke-test:
80+
name: Post-Deployment Smoke Test
81+
needs: deploy
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Check Documentation URL
85+
run: |
86+
# Wait a few seconds for CDN propagation
87+
sleep 10
88+
# Verify the versioned documentation path exists
89+
curl --fail -sL https://fireblade-engine.github.io/math/main/documentation/fireblademath/ | grep -q "FirebladeMath"
90+
echo "Documentation is live at /math/main/"
91+
92+
- name: Check Root Redirect
93+
run: |
94+
# Verify that the root URL redirects correctly
95+
RESPONSE=$(curl -sI https://fireblade-engine.github.io/math/ | head -n 1)
96+
# Note: GitHub Pages might return 200 with the redirect meta tag, or a 301/302 if configured at the DNS level.
97+
# Since we use a meta/JS redirect, we check for a 200 OK and then the content.
98+
curl -s https://fireblade-engine.github.io/math/ | grep -q "Redirecting to"
99+
echo "Root redirect is live at /math/"

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ UNAME_S := $(shell uname -s)
22
SWIFT_FLAGS ?= --disable-sandbox
33
PACKAGE_SWIFT_VERSION := $(shell grep "swift-tools-version" Package.swift | head -n 1 | cut -d ":" -f 2 | xargs)
44

5-
HOSTING_BASE_PATH ?= fireblade-math
5+
# Repository name on GitHub Pages
6+
REPO_NAME ?= math
7+
# Subdirectory for versioned documentation (e.g., main, 1.0.0)
8+
DOCS_VERSION_PATH ?= main
9+
10+
# The full base path for hosting
11+
HOSTING_BASE_PATH ?= $(REPO_NAME)/$(DOCS_VERSION_PATH)
612

713
# Targets
814
.PHONY: setup lint lint-fix test test-coverage clean pre-commit docs docs-preview docs-generate docs-coverage
@@ -19,14 +25,14 @@ docs-preview:
1925
swift package --disable-sandbox preview-documentation --target FirebladeMath
2026

2127
docs-generate:
28+
mkdir -p .build/documentation/$(DOCS_VERSION_PATH)
2229
swift package --disable-sandbox \
2330
--allow-writing-to-directory .build/documentation \
2431
generate-documentation --target FirebladeMath \
2532
--disable-indexing \
2633
--transform-for-static-hosting \
2734
--hosting-base-path $(HOSTING_BASE_PATH) \
28-
--output-path .build/documentation
29-
35+
--output-path .build/documentation/$(DOCS_VERSION_PATH)
3036
docs-coverage: docs-check-coverage
3137

3238
docs-check-coverage:

0 commit comments

Comments
 (0)