Skip to content

Commit cdc9a19

Browse files
committed
ci: build and deploy workflow
1 parent 09312e9 commit cdc9a19

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Setup Rust
2+
3+
runs:
4+
using: composite
5+
6+
steps:
7+
- name: Install sccache
8+
uses: mozilla-actions/sccache-action@v0.0.9
9+
10+
- name: Install Rust
11+
uses: dtolnay/rust-toolchain@stable
12+
13+
- name: Install Rust cache
14+
uses: Swatinem/rust-cache@v2
15+
with:
16+
cache-targets: false
17+
18+
- name: Install Just
19+
run: cargo install just
20+
shell: bash
21+
22+
- name: Install Nextest
23+
uses: taiki-e/install-action@nextest

.github/workflows/deploy.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy mdBook to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
permissions:
10+
contents: write
11+
12+
concurrency:
13+
group: pages
14+
cancel-in-progress: false
15+
16+
jobs:
17+
publish:
18+
name: Build and publish
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup Rust
27+
uses: ./.github/actions/setup-rust
28+
29+
- name: Install mdBook and plugins
30+
run: |
31+
cargo install mdbook || true
32+
cargo install mdbook-admonish || true
33+
cargo install mdbook-katex || true
34+
cargo install mdbook-linkcheck || true
35+
36+
- name: Build
37+
run: mdbook build
38+
39+
- name: Publish to github-pages branch
40+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
41+
uses: peaceiris/actions-gh-pages@v4
42+
with:
43+
github_token: ${{ secrets.GITHUB_TOKEN }}
44+
publish_branch: github-pages
45+
publish_dir: book
46+
force_orphan: true
47+
commit_message: "Publish book from ${GITHUB_SHA}"

0 commit comments

Comments
 (0)