Skip to content

Commit 7203555

Browse files
committed
feat: Add mdbook page generation and preview
1 parent f12c859 commit 7203555

17 files changed

Lines changed: 108 additions & 3 deletions
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: mdBook PR Preview
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, closed]
6+
paths:
7+
- "docs/**"
8+
- ".github/workflows/preview-mdbook.yml"
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
concurrency: preview-${{ github.ref }}
15+
16+
jobs:
17+
deploy-preview:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install mdBook
23+
run: cargo install mdbook
24+
25+
- name: Build mdBook
26+
run: mdbook build docs
27+
28+
- name: Deploy PR Preview
29+
uses: rossjrw/pr-preview-action@v1.4.7
30+
with:
31+
source-dir: docs/book
32+
umbrella-dir: docs/pr-preview
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Documentation Deploy
2+
3+
on:
4+
# When a PR is merged (or force push to main)
5+
push:
6+
branches: ["main"]
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# Enable cargo logs to be in colour
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
build-mdbook:
26+
name: Build and Deploy mdBook
27+
environment:
28+
name: github-pages
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Install mdBook
34+
run: cargo install mdbook --locked
35+
36+
- name: Build the book
37+
run: mdbook build docs
38+
39+
- name: Deploy to GitHub Pages
40+
uses: peaceiris/actions-gh-pages@v4.0.0
41+
with:
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
publish_dir: ./docs/book
44+
publish_branch: gh-pages
45+
destination_dir: ./main/

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@
44

55
.PHONY: ci-job-format
66
ci-job-format:
7-
@echo "Checking formating of source files..."
7+
@echo "Checking formatting of source files..."
88
@./tools/run_fmt_check.sh
99

1010
.PHONY: ci-job-clippy
1111
ci-job-clippy:
1212
@echo "Running clippy on source files..."
1313
@./tools/run_clippy.sh
1414

15+
.PHONY: ci-job-mdbook
16+
ci-job-mdbook:
17+
@echo "Generating book.toml..."
18+
@echo "Installing mdBook"
19+
@which mdbook >/dev/null 2>&1 || cargo install mdbook --locked
20+
@echo "Building docs"
21+
@mdbook build docs
22+
1523
.PHONY: ci-runner-github
16-
ci-runner-github: ci-job-format ci-job-clippy
24+
ci-runner-github: ci-job-format ci-job-clippy ci-job-mdbook
1725
@echo "Running cargo check..."
1826
@cargo check
1927
@echo "Running tests..."
20-
@cargo test
28+
@cargo test

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
book

docs/book.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[book]
2+
authors = ["Tockloader-rs Contributors"]
3+
language = "en"
4+
src = "src"
5+
title = "Tockloader-rs Dev Notes"

docs/src/SUMMARY.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Summary
2+
3+
- [Introduction](intro.md)
4+
5+
- [Tockloader-rs Commands](commands/index.md)
6+
- [Listen](commands/listen.md)
7+
- [Info](commands/info.md)
8+
- [List](commands/list.md)
9+
- [Install](commands/install.md)
10+
11+
- [Tock Concepts](concepts/index.md)
12+
- [TBF Headers](concepts/tbf_headers.md)
13+
- [Bootloader](concepts/bootloader.md)
14+
- [Bootloader Attributes](concepts/bootloader_attributes.md)

docs/src/commands/index.md

Whitespace-only changes.

docs/src/commands/info.md

Whitespace-only changes.

docs/src/commands/install.md

Whitespace-only changes.

docs/src/commands/list.md

Whitespace-only changes.

0 commit comments

Comments
 (0)