File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy mdBook to GitHub Pages (With PR Preview)
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - gh-pages
8+ pull_request :
9+ branches :
10+ - main
11+
12+ permissions :
13+ contents : write
14+ pages : write
15+ id-token : write
16+
17+ jobs :
18+ build :
19+ runs-on : ubuntu-latest
20+ steps :
21+ - name : Checkout repo
22+ uses : actions/checkout@v4
23+
24+ - name : Install mdBook if missing
25+ run : |
26+ if ! command -v mdbook >/dev/null; then
27+ echo "mdbook not found, installing..."
28+ cargo install mdbook --version "^0.4"
29+ else
30+ echo "mdbook is already installed"
31+ fi
32+
33+ - name : Build mdBook
34+ run : mdbook build docs
35+
36+ - name : Upload artifact
37+ uses : actions/upload-pages-artifact@v3
38+ with :
39+ path : ./docs/book
40+
41+ deploy :
42+ needs : build
43+ runs-on : ubuntu-latest
44+ if : github.event_name != 'pull_request' || github.event.action == 'opened' || github.event.action == 'synchronize'
45+ environment :
46+ name : github-pages
47+ url : ${{ steps.deployment.outputs.page_url }}
48+ steps :
49+ - name : Deploy to GitHub Pages
50+ id : deployment
51+ uses : actions/deploy-pages@v4
You can’t perform that action at this time.
0 commit comments