How to build mdBook with Github Actions

katopz
2 min readOct 27, 2022

--

📚 Step by step mdBook deploy to github page with github actions, it should be simple but https://github.com/peaceiris/actions-mdbook guide confusing me “a lot”. Luckily I found this tuts which save me a lot of time and as usual here’s my compilation for my own sake.

  1. Use template: https://github.com/zjp-CN/mdbook-template

2. Goto your Github repos then SettingPages and select Deploy from branch via main and pathroot as see below. 👇

3. Then git push and things.should be all green. ✅

4. Browse your page and you should see it’s up and running.

5. Then the setting switch back to Github Actions.

6. An try add something to /src/chapter_1.md and git push to see the change after build complete.

7. Cool, it’s working Hello World!

8. Build and run on local

# Install mdbook
cargo install mdbook
# Because template need this. // See book.toml
cargo install mdbook-theme
# You will need new terminal for this one.
mdbook serve

Gotcha!

if you found that localhost:3000 appear 404 try stop the server first and remove these lines in book.toml then mdbook serve again.

[output.theme-ace]
theme-white = "xcode"
theme-dark = "monokai"

Hope this help! Oh I’m now (try to) become a Rustacean 🦀 so my blog from now on will be mostly myRust and Wasm journey! So fun!

--

--