File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ name: Build mdBook
22
33on :
44 workflow_call :
5+ inputs :
6+ run-swift-tests :
7+ description : " Run the swift-test backend (HTML lands under book/html/)"
8+ type : boolean
9+ default : true
510 outputs :
611 artifact-path :
712 description : " Path to the built book artifact"
1419 build :
1520 runs-on : ubuntu-latest
1621 outputs :
17- artifact-path : . /better-code/book
22+ artifact-path : ${{ inputs.run-swift-tests && '. /better-code/book/html' || './better-code/book' }}
1823 steps :
1924 - name : Checkout
2025 uses : actions/checkout@v6
3944 chmod +x scripts/install-tools.sh
4045 ./scripts/install-tools.sh
4146
47+ - name : Configure HTML-only build
48+ if : ${{ !inputs.run-swift-tests }}
49+ working-directory : better-code
50+ run : sed -i '/^# Tests all Swift code blocks/,$d' book.toml
51+
4252 - name : Setup Swift
53+ if : inputs.run-swift-tests
4354 uses : swift-actions/setup-swift@v2
4455
4556 - name : Build with mdBook
4960 uses : actions/upload-artifact@v7
5061 with :
5162 name : mdbook-build-ubuntu-latest
52- path : . /better-code/book
63+ path : ${{ inputs.run-swift-tests && '. /better-code/book/html' || './better-code/book' }}
5364 retention-days : 1
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ concurrency:
1919jobs :
2020 build :
2121 uses : ./.github/workflows/build.yml
22+ with :
23+ run-swift-tests : false
2224 permissions :
2325 contents : read
2426
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ Open http://localhost:3000 in your browser.
5858- No deployment; PR check shows build status
5959
6060** Main Branch:**
61- - Builds book using mdBook with versions from ` versions.txt `
61+ - Builds HTML only (no swift-test) using mdBook with versions from ` versions.txt `
6262- Deploys to GitHub Pages
6363- Available at https://stlab.github.io/better-code/
6464
@@ -77,7 +77,8 @@ All tool versions are centrally managed in `versions.txt`. To update:
7777better-code/ # mdBook source and configuration
7878├── src/ # Markdown chapter files
7979├── book.toml # mdBook configuration
80- └── book/ # Generated HTML (gitignored)
80+ └── book/ # Generated output (gitignored)
81+ └── html/ # HTML when swift-test backend is enabled (PR/CI)
8182
8283scripts/ # Installation scripts
8384├── install-tools.sh # Linux/macOS
@@ -96,7 +97,8 @@ archive/ # Legacy Jekyll site (for reference only)
9697mdbook build ./better-code
9798```
9899
99- Output will be in ` ./better-code/book/ ` .
100+ With all backends enabled (default), HTML is in ` ./better-code/book/html/ ` .
101+ An HTML-only build (as on deploy) writes to ` ./better-code/book/ ` .
100102
101103
102104## Legacy Content
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ build-dir = "book"
1212git-repository-url = " https://github.com/stlab/better-code"
1313edit-url-template = " https://github.com/stlab/better-code/edit/main/better-code/{path}"
1414site-url = " /better-code/"
15- cname = " stlab.github.io"
1615
1716[output .html .search ]
1817enable = true
You can’t perform that action at this time.
0 commit comments