Skip to content

Commit 14ddd4e

Browse files
committed
feat: add mdbook to gh pages deploy
1 parent 7c02ed8 commit 14ddd4e

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/mdbook_deploy.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Deploy mdBook
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
container: mcr.microsoft.com/devcontainers/rust
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Install Node.js
17+
run: |
18+
apt-get update
19+
apt-get install -y nodejs npm
20+
node -v
21+
npm -v
22+
23+
- name: Cache cargo registry
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/.cargo/registry
27+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-cargo-registry-
30+
31+
- name: Cache cargo index
32+
uses: actions/cache@v3
33+
with:
34+
path: ~/.cargo/git
35+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-cargo-index-
38+
39+
- name: Cache npm
40+
uses: actions/cache@v3
41+
with:
42+
path: ~/.npm
43+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
44+
restore-keys: |
45+
${{ runner.os }}-npm-
46+
47+
- name: Install mdBook
48+
run: cargo install mdbook
49+
50+
- name: Build mdBook
51+
run: mdbook build
52+
53+
- name: Set up GitHub token
54+
run: echo "::set-env name=GITHUB_TOKEN::${{ secrets.GITHUB_TOKEN }}"
55+
56+
- name: Deploy to GitHub Pages
57+
uses: peaceiris/actions-gh-pages@v3
58+
with:
59+
github_token: ${{ secrets.GITHUB_TOKEN }}
60+
publish_dir: ./book
61+
publish_branch: gh-pages
62+
user_name: 'github-actions[bot]'
63+
user_email: '41898282+github-actions[bot]@users.noreply.github.com'

0 commit comments

Comments
 (0)