Skip to content

Commit 07c795a

Browse files
committed
ci: build and deploy workflows
1 parent 09312e9 commit 07c795a

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-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: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
name: Build
21+
runs-on: ubuntu-latest
22+
if: github.event_name != 'push' || github.ref == 'refs/heads/master'
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Pages
28+
uses: actions/configure-pages@v5
29+
30+
- name: Setup Rust
31+
uses: ./.github/actions/setup-rust
32+
33+
- name: Install mdBook and plugins
34+
run: |
35+
cargo install mdbook
36+
cargo install mdbook-admonish
37+
cargo install mdbook-katex
38+
cargo install mdbook-linkcheck
39+
40+
- name: Build
41+
run: mdbook build
42+
43+
- name: Upload artifact
44+
uses: actions/upload-pages-artifact@v3
45+
with:
46+
path: book
47+
48+
# Deploy when PR is merged or direct push to master
49+
deploy:
50+
name: Deploy
51+
runs-on: ubuntu-latest
52+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
53+
needs:
54+
- build
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)