-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (90 loc) · 2.97 KB
/
docs.yml
File metadata and controls
106 lines (90 loc) · 2.97 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
name: Build and Deploy Documentation
on:
push:
branches: [ main ]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
check:
runs-on: ubuntu-latest
outputs:
docs-changed: ${{ steps.check.outputs.docs-changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for documentation changes
id: check
run: |
# For push to main, compare against previous commit
BASE_SHA="HEAD~1"
HEAD_SHA="HEAD"
# Check if documentation-relevant files changed
if git diff --name-only $BASE_SHA $HEAD_SHA | grep -E "(^include/|^docs/|^README\.md$|^CMakeLists\.txt$|^cmake/EnableDocs\.cmake$)" > /dev/null; then
echo "docs-changed=true" >> $GITHUB_OUTPUT
echo "Documentation-relevant files changed, proceeding with build"
else
echo "docs-changed=false" >> $GITHUB_OUTPUT
echo "No documentation-relevant files changed, skipping build"
fi
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.docs-changed == 'true'
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
echo 'set man-db/auto-update false' | sudo debconf-communicate >/dev/null
sudo dpkg-reconfigure man-db
sudo apt-get update
sudo apt-get install -y ninja-build gcc g++ ccache cmake doxygen graphviz python3-all
- name: Create cache directories
run: mkdir -p ~/.ccache ~/.cache/CPM
- name: Setup ccache
uses: actions/cache@v4
with:
path: ~/.ccache
key: cppnet-ccache-${{ runner.os }}-${{ hashFiles('**/*.cpp', '**/*.hpp', '**/*.h', '**/*.c') }}
restore-keys: |
cppnet-ccache-${{ runner.os }}-
- name: Cache CMake build directory
uses: actions/cache@v4
with:
path: |
build/debug/_deps
build/debug/CMakeCache.txt
build/debug/CMakeFiles
key: cppnet-cmake-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt', 'CMakePresets.json') }}
restore-keys: |
cppnet-cmake-${{ runner.os }}-
- name: Cache CPM sources.
uses: actions/cache@v4
with:
path: ~/.cache/CPM
key: cppnet-cpm-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
cppnet-cpm-${{ runner.os }}-
- name: Configure CMake
run: |
cmake --preset debug \
-DCPM_SOURCE_CACHE='~/.cache/CPM' \
-DCPPNET_BUILD_TESTING='OFF' \
-DCPPNET_BUILD_DOCS='ON'
- name: Build documentation
run: cmake --build --preset debug --target docs
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4