-
Notifications
You must be signed in to change notification settings - Fork 26
52 lines (42 loc) · 1.24 KB
/
publish-mdbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Publish mdBook to Vercel
on:
push:
branches: ["main"]
paths:
- "book/**"
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Setup mdbook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "latest"
- name: Install mdbook plugins
run: |
cargo install mdbook-katex mdbook-linkcheck mdbook-mermaid just
- name: Build the book
run: |
cd book
mdbook build
- name: Install Vercel CLI
run: npm install -g vercel
- name: Deploy to Vercel
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} # Token stored in GitHub Secrets
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
run: |
cd book/book
mkdir .vercel
echo "{\"projectId\":\"$VERCEL_PROJECT_ID\",\"orgId\":\"$VERCEL_ORG_ID\"}" > .vercel/project.json
vercel --prod --token $VERCEL_TOKEN