-
Notifications
You must be signed in to change notification settings - Fork 5
44 lines (41 loc) · 1.19 KB
/
docs.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
name: Documentation
on:
push:
branches: [master]
tags: ["*"]
pull_request:
# Check all PR
jobs:
build-and-publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: setup rust
uses: dtolnay/rust-toolchain@stable
- name: build documentation
run: |
cargo doc --no-deps
- name: put documentation in the website
run: |
git clone https://github.com/$GITHUB_REPOSITORY --branch gh-pages gh-pages
rm -rf gh-pages/.git
cd gh-pages
REF_KIND=$(echo $GITHUB_REF | cut -d / -f2)
if [[ "$REF_KIND" == "tags" ]]; then
TAG=${GITHUB_REF#refs/tags/}
mv ../target/doc/ $TAG
cp _redirect.html $TAG/index.html
else
rm -rf latest
mv ../target/doc/ latest
cp _redirect.html latest/index.html
fi
- name: deploy to gh-pages
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages/
force_orphan: true