-
-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (116 loc) · 3.5 KB
/
build-docs.yml
File metadata and controls
124 lines (116 loc) · 3.5 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
cache-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- run: rustup update --no-self-update
- name: Cache .cargo locked resources
uses: actions/cache@v5
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch
build-mkdocs:
runs-on: ubuntu-latest
needs: [cache-deps]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Cache .cargo locked resources
uses: actions/cache/restore@v5
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@1800853f2578f8c34492ec76154caef8e163fbca # v1.17.7
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nur
run: cargo binstall -y nur
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Build docs
run: nur docs --build
- name: Upload docs build as artifact
uses: actions/upload-pages-artifact@v4
with:
name: cpp-linter-docs
path: docs/site
build-rustdoc:
runs-on: ubuntu-latest
needs: [cache-deps]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- run: rustup update --no-self-update
- name: Cache .cargo locked resources
uses: actions/cache/restore@v5
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@1800853f2578f8c34492ec76154caef8e163fbca # v1.17.7
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nur
run: cargo binstall -y nur
env:
GITHUB_TOKEN: ${{ github.token }}
- run: nur docs rs
- name: upload rustdoc build as artifact
uses: actions/upload-artifact@v7
with:
path: target/doc
name: cpp-linter-api_docs
deploy:
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
needs: [build-mkdocs]
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
id: deployment
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifact_name: cpp-linter-docs