Skip to content

Commit 49eaf2f

Browse files
committed
ci: add GitHub Pages deployment workflow with mdbook-lint
- Add workflow to automatically build and deploy mdBook to GitHub Pages - Triggers on pushes to main branch when docs change - Includes mdbook-lint for quality checks on documentation - Configure book.toml with correct repository URLs and lint settings - Cache mdbook-lint installation for faster CI runs - Only deploys on main branch, builds on PRs for validation
1 parent 4dc6315 commit 49eaf2f

File tree

2 files changed

+88
-3
lines changed

2 files changed

+88
-3
lines changed

.github/workflows/mdbook.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Deploy mdBook to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/mdbook.yml'
10+
pull_request:
11+
paths:
12+
- 'docs/**'
13+
- '.github/workflows/mdbook.yml'
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
concurrency:
22+
group: "pages"
23+
cancel-in-progress: false
24+
25+
jobs:
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Setup mdBook
34+
uses: peaceiris/actions-mdbook@v2
35+
with:
36+
mdbook-version: 'latest'
37+
38+
- name: Cache mdbook-lint
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.cargo/bin/mdbook-lint
42+
key: mdbook-lint-${{ runner.os }}
43+
44+
- name: Install mdbook-lint
45+
run: |
46+
command -v mdbook-lint || cargo install mdbook-lint
47+
48+
- name: Lint book
49+
run: |
50+
cd docs
51+
mdbook-lint
52+
53+
- name: Build book
54+
run: |
55+
cd docs
56+
mdbook build
57+
58+
- name: Upload artifact
59+
if: github.event_name != 'pull_request'
60+
uses: actions/upload-pages-artifact@v3
61+
with:
62+
path: ./docs/book
63+
64+
deploy:
65+
if: github.event_name != 'pull_request'
66+
environment:
67+
name: github-pages
68+
url: ${{ steps.deployment.outputs.page_url }}
69+
runs-on: ubuntu-latest
70+
needs: build
71+
steps:
72+
- name: Deploy to GitHub Pages
73+
id: deployment
74+
uses: actions/deploy-pages@v4

docs/book.toml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,26 @@
22
authors = ["Josh Rotenberg"]
33
language = "en"
44
src = "src"
5-
title = "Redis Enterprise API Documentation"
5+
title = "redisctl Documentation"
66

77
[output.html]
88
default-theme = "light"
99
preferred-dark-theme = "ayu"
10-
git-repository-url = "https://github.com/joshrotenberg/redis-enterprise-rs"
10+
git-repository-url = "https://github.com/joshrotenberg/redisctl"
1111
git-repository-icon = "fa-github"
12-
edit-url-template = "https://github.com/joshrotenberg/redis-enterprise-rs/edit/main/docs/{path}"
12+
edit-url-template = "https://github.com/joshrotenberg/redisctl/edit/main/docs/{path}"
1313

1414
[output.html.fold]
1515
enable = true
1616
level = 1
17+
18+
[preprocessor.lint]
19+
command = "mdbook-lint"
20+
renderer = ["html"]
21+
22+
# mdbook-lint configuration
23+
[output.lint]
24+
# Warn about broken links
25+
warn-on-broken-links = true
26+
# Warn about unresolved links
27+
warn-on-unresolved-links = true

0 commit comments

Comments
 (0)