-
-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (143 loc) · 4.41 KB
/
Copy pathbuild-docs.yml
File metadata and controls
152 lines (143 loc) · 4.41 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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.0.2
with:
persist-credentials: false
- run: rustup update --no-self-update
- name: Cache .cargo locked resources
uses: actions/cache@v5.0.5
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch
seed-build-script:
runs-on: ubuntu-latest
name: Pre-seed static binaries' versions
steps:
- env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release download
-R cpp-linter/clang-tools-static-binaries
--pattern versions.json
--output versions.json
- name: Upload versions.json
uses: actions/upload-artifact@v7
with:
name: static-binary-versions
path: versions.json
if-no-files-found: error
build-mkdocs:
runs-on: ubuntu-latest
needs: [cache-deps, seed-build-script]
steps:
- uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Cache .cargo locked resources
uses: actions/cache/restore@v5.0.5
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@aaa84a43aec4955a42c5ffc65d258961e39f276e # v1.19.1
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nur
run: cargo binstall -y nur
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Restore build script seed
uses: actions/download-artifact@v8
with:
name: static-binary-versions
path: clang-tools-manager
- name: Build docs
run: nur docs --build
- name: Upload docs build as artifact
uses: actions/upload-pages-artifact@v5
with:
name: cpp-linter-docs
path: docs/site
build-rustdoc:
runs-on: ubuntu-latest
needs: [cache-deps, seed-build-script]
steps:
- uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- run: rustup update --no-self-update
- name: Cache .cargo locked resources
uses: actions/cache/restore@v5.0.5
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@aaa84a43aec4955a42c5ffc65d258961e39f276e # v1.19.1
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nur
run: cargo binstall -y nur
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Restore build script seed
uses: actions/download-artifact@v8
with:
name: static-binary-versions
path: clang-tools-manager
- 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@v5
id: deployment
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifact_name: cpp-linter-docs