Skip to content
Merged
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6

# Cache Rust toolchain and cargo registry
- name: Cache Rust
uses: actions/cache@v4
Expand All @@ -36,24 +36,27 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('versions.txt') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install mdBook and plugins (Linux)
if: runner.os != 'Windows'
run: |
chmod +x scripts/install-tools.sh
./scripts/install-tools.sh

- name: Install mdBook and plugins (Windows)
if: runner.os == 'Windows'
run: .\scripts\install-tools.ps1


# Install Swift for testing Swift code examples in the book
- name: Setup Swift
uses: swift-actions/setup-swift@v3

- name: Build with mdBook
run: mdbook build ./better-code

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: mdbook-build-${{ matrix.os }}
path: ./better-code/book
retention-days: 1

7 changes: 7 additions & 0 deletions better-code/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ enable = true

[output.html.print]
enable = true

[output.html.code.hidelines]
swift = "#"

# Tests all Swift code blocks during `mdbook build`
[output.swift-test]
command = "python3 ../../../scripts/mdbook-swift-test.py"
Loading
Loading