How to build mdBook with Github Actions
โ ๏ธ [2025/03/21] Github deprecated an action! take a look at my book deployment for updated version here ๐ https://github.com/gist-rs/book/tree/main/.github/workflows
๐ 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.
- Use template: https://github.com/zjp-CN/mdbook-template
2. Goto your Github repos then Setting
โ Pages
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!
# 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!