Skip to content

Commit eecabe0

Browse files
committed
Deploy mdBook docs via GitHub Actions
1 parent 551f85d commit eecabe0

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Install mdbook
23+
run: |
24+
tag=$(curl -s https://api.github.com/repos/rust-lang/mdbook/releases/latest | jq -r '.tag_name')
25+
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
26+
mkdir mdbook && curl -sSL "$url" | tar -xz --directory=./mdbook
27+
echo "$PWD/mdbook" >> "$GITHUB_PATH"
28+
- name: Build book
29+
run: cd docs && mdbook build
30+
- name: Upload artifact
31+
uses: actions/upload-pages-artifact@v3
32+
with:
33+
path: docs/book
34+
35+
deploy:
36+
needs: build
37+
runs-on: ubuntu-latest
38+
environment:
39+
name: github-pages
40+
url: ${{ steps.deployment.outputs.page_url }}
41+
steps:
42+
- name: Deploy to GitHub Pages
43+
id: deployment
44+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)