Skip to content

Commit 40ff630

Browse files
committed
Add a github action to build and deploy the book
1 parent fbccd67 commit 40ff630

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/book.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Book
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '[0-9]+.[0-9]+.[0-9]+'
8+
9+
env:
10+
RUST_BACKTRACE: full
11+
12+
jobs:
13+
build:
14+
name: Build and deploy book
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- run: cargo install mdbook
19+
- name: Build examples
20+
run: cd ${{ github.workspace }}/examples/basic_charts && cargo run
21+
- run: mdbook build docs/book
22+
- name: Checkout gh-pages branch
23+
run: |
24+
git fetch origin gh-pages:gh-pages
25+
git checkout gh-pages
26+
- name: Overwrite book content
27+
run: |
28+
rm -rf content
29+
cp -r gh-pages/content .
30+
- name: Deploy to GitHub Pages
31+
run: |
32+
git config --global user.name 'github-actions[bot]'
33+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
34+
35+
git add content
36+
git commit --allow-empty -m 'Deploy to GitHub Pages'
37+
git push origin gh-pages

0 commit comments

Comments
 (0)