Skip to content

Commit 74b40d9

Browse files
committed
Update README and GitHub Actions to support HTML-only builds without swift-test backend
1 parent 953aaf3 commit 74b40d9

4 files changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Build mdBook
22

33
on:
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"
@@ -14,7 +19,7 @@ jobs:
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
@@ -39,7 +44,13 @@ jobs:
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
@@ -49,5 +60,5 @@ jobs:
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

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ concurrency:
1919
jobs:
2020
build:
2121
uses: ./.github/workflows/build.yml
22+
with:
23+
run-swift-tests: false
2224
permissions:
2325
contents: read
2426

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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:
7777
better-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
8283
scripts/ # Installation scripts
8384
├── install-tools.sh # Linux/macOS
@@ -96,7 +97,8 @@ archive/ # Legacy Jekyll site (for reference only)
9697
mdbook 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

better-code/book.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ build-dir = "book"
1212
git-repository-url = "https://github.com/stlab/better-code"
1313
edit-url-template = "https://github.com/stlab/better-code/edit/main/better-code/{path}"
1414
site-url = "/better-code/"
15-
cname = "stlab.github.io"
1615

1716
[output.html.search]
1817
enable = true

0 commit comments

Comments
 (0)