forked from theseus-os/Theseus
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (78 loc) · 2.78 KB
/
docs.yaml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Documentation
on: [push, pull_request]
jobs:
documentation:
name: Build and deploy
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: "Install nasm"
run: sudo apt install nasm
- name: Cache build artifacts
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
${{ runner.os }}-
# Remove documentation directory cache before publishing.
- name: Clean source documentation directory before publishing
if: github.event_name == 'push' && github.ref == 'refs/heads/theseus_main'
run: cargo clean --doc
- name: Install mdbook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.4.10'
- name: Install mdbook-linkcheck
run: |
version="v0.7.4"
file="mdbook-linkcheck"
zip_file="mdbook-linkcheck.${version}.x86_64-unknown-linux-gnu.zip"
curl -sSL https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/${version}/${zip_file} --output ${zip_file}
unzip -d bin ${zip_file} ${file}
chmod +x bin/${file}
rm ${zip_file}
echo "$(pwd)/bin" >> ${GITHUB_PATH}
- name: Report versions
run: |
rustc --version --verbose
mdbook --version
mdbook-linkcheck --version
- name: Build book
run: make book
- name: Run spell check
uses: streetsidesoftware/cspell-action@v2
with:
config: 'book/cspell.json'
files: 'book/**'
incremental_files_only: false
# Enforce strict spell check except on push to main branch.
strict: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/theseus_main') }}
- name: Build source documentation
run: make doc
# Move build artifacts to publish directory on push to main branch.
- name: Move build artifacts
if: github.event_name == 'push' && github.ref == 'refs/heads/theseus_main'
run: |
rm -rf ./github_pages/book
rm -rf ./github_pages/doc
mv ./build/book/html/ ./github_pages/book/
mv ./build/doc/ ./github_pages/doc/
# Deploy on push to main branch.
- name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/theseus_main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: ${{ github.event.head_commit.message }}
publish_branch: github_pages
publish_dir: ./github_pages