Skip to content

Commit 5a19a28

Browse files
add mdbook contributing documentation
* also address review comments for Makefile, docs/install-and-build-mdbook.sh script
1 parent b16a6a8 commit 5a19a28

File tree

3 files changed

+73
-7
lines changed

3 files changed

+73
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,5 +324,5 @@ docs: ## Build the mdBook locally using the same script Netlify uses.
324324
GO_VERSION=$(GO_VERSION) MDBOOK_VERSION=$(MDBOOK_VERSION) $(MDBOOK_SCRIPT)
325325

326326
.PHONY: docs-serve
327-
docs-serve: ## Serve mdBook locally (requires mdbook installed locally).
327+
docs-serve: ## Serve mdBook locally.
328328
GO_VERSION=$(GO_VERSION) MDBOOK_VERSION=$(MDBOOK_VERSION) $(MDBOOK_SCRIPT) serve docs/book --open

docs/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
## Documentation (mdBook)
2+
3+
This repository’s documentation is built using [**mdBook**](https://github.com/rust-lang-nursery/mdBook).
4+
5+
Local builds and hosted builds use the same build script [1] to ensure consistent behavior.
6+
7+
## Local documentation workflows
8+
9+
All documentation targets **must be run from the repository root**.
10+
11+
### Available Makefile targets
12+
13+
```bash
14+
make docs # Build the mdBook locally using the shared build script
15+
make docs-serve # Serve the mdBook locally
16+
```
17+
18+
## Build script contract
19+
20+
The documentation build is driven by:
21+
22+
```
23+
docs/book/install-and-build-mdbook.sh
24+
```
25+
26+
This script defines how mdBook is installed and executed.
27+
28+
### Environment variables
29+
30+
The build relies on the following environment variables:
31+
32+
| Variable | Description |
33+
| ---------------- | -------------------------------- |
34+
| `GO_VERSION` | Go version used during the build |
35+
| `MDBOOK_VERSION` | mdBook version to install/use |
36+
37+
38+
## Version synchronization requirements
39+
40+
The environment variables used for documentation builds must be kept **consistent across the repository**.
41+
42+
When either `GO_VERSION` or `MDBOOK_VERSION` is changed, the update **must be applied in all of the following locations**:
43+
44+
1. **Makefile**
45+
Used for local documentation builds and serving.
46+
47+
2. **`netlify.toml`**
48+
Used for hosted and preview builds.
49+
50+
3. **`docs/book/install-and-build-mdbook.sh`**
51+
Used as the canonical build script.
52+
53+
## Editing documentation
54+
55+
1. Make changes under:
56+
57+
```
58+
docs/book/src/
59+
```
60+
2. Preview changes locally:
61+
62+
```bash
63+
make docs-serve
64+
```
65+
3. Commit only source files; generated output is produced during the build.
66+
67+
---
68+
69+
[1] [`docs/book/install-and-build-mdbook.sh`](book/install-and-build-mdbook.sh)
70+

docs/book/install-and-build-mdbook.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,10 @@ os=$(go env GOOS)
3737
arch=$(go env GOARCH)
3838

3939
# translate arch to rust's conventions (if we can)
40-
if [[ ${arch} == "amd64" ]]; then
40+
if [[ ${arch} == "amd64" || ${arch} == "x86" ]]; then
4141
arch="x86_64"
42-
elif [[ ${arch} == "x86" ]]; then
43-
arch="i686"
4442
elif [[ ${arch} == "arm64" ]]; then
45-
# arm64 is not supported for v0.4.40 mdbook, so using x86_64 type.
46-
# Once the mdbook is upgraded to latest, use 'aarch64'
47-
arch="x86_64"
43+
arch="aarch64"
4844
fi
4945

5046
# translate os to rust's conventions (if we can)

0 commit comments

Comments
 (0)