-
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (91 loc) · 2.52 KB
/
build-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
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
92
93
94
95
96
name: Docs
on:
push:
branches: [main]
paths:
- docs/**
- .github/workflows/build-docs.yml
- cpp-linter/src/**
- '*.md'
- '*/*.md'
pull_request:
branches: [main]
paths:
- docs/**
- .github/workflows/build-docs.yml
- cpp-linter/src/**
- '*.md'
- '*/*.md'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
cache-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update
- name: Cache .cargo locked resources
uses: actions/cache@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch
build-mkdocs:
runs-on: ubuntu-latest
needs: [cache-deps]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Cache .cargo locked resources
uses: actions/cache/restore@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- uses: actions/setup-python@v5
with:
python-version: 3.x
cache: 'pip'
cache-dependency-path: docs/requirements.txt
- name: Install workflow deps
run: |
pip install -r docs/requirements.txt
pip install --force-reinstall -v docs/
- name: Build docs
working-directory: docs
run: mkdocs build
- name: Upload docs build as artifact
uses: actions/upload-artifact@v4
with:
name: cpp-linter-docs
path: docs/site
- name: Upload to github pages
# only publish doc changes from main branch
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/site
build-rustdoc:
runs-on: ubuntu-latest
needs: [cache-deps]
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update
- name: Cache .cargo locked resources
uses: actions/cache/restore@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just
- run: just docs-rs
- name: upload rustdoc build as artifact
uses: actions/upload-artifact@v4
with:
path: target/doc
name: cpp-linter-api_docs