1
+ name : ' build-docs'
2
+ description : ' Builds documentation using Doxygen'
3
+ inputs :
4
+ cmake_target :
5
+ description : ' CMake documentation target'
6
+ required : true
7
+ docs_dir :
8
+ description : ' Path to documentation dir, relative to build_dir'
9
+ required : true
10
+ github_token :
11
+ description : ' GitHub token'
12
+ required : true
13
+ build_dir :
14
+ description : ' Build directory'
15
+ required : false
16
+ default : ' build'
17
+ cmake_configure_args :
18
+ description : ' Additional CMake configure arguments'
19
+ required : false
20
+ default : ' '
21
+ destination_dir :
22
+ description : ' Directory name for deployed docs'
23
+ required : false
24
+ default : ' '
25
+ docs_branch :
26
+ description : ' Documentation branch'
27
+ required : false
28
+ default : ' gh-pages'
29
+
30
+ outputs :
31
+ version :
32
+ description : ' Version of the generated docs'
33
+ value : ${{ steps.get-docs-version.outputs.version }}
34
+
35
+ runs :
36
+ using : " composite"
37
+ steps :
38
+ - name : Install deps
39
+ shell : bash
40
+ run : |
41
+ sudo apt install -y cmake
42
+ sudo apt install -y wget
43
+ cd ~
44
+ wget -nv https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz
45
+ tar -xzf doxygen-1.10.0.linux.bin.tar.gz
46
+ echo "$(pwd)/doxygen-1.10.0/bin" >> $GITHUB_PATH
47
+
48
+ - name : CMake configuration
49
+ shell : bash
50
+ run : cmake ${{ inputs.cmake_configure_args }} -B ${{ inputs.build_dir }} -DENUM_NAME_BUILD_DOCS=ON
51
+
52
+ - name : CMake build
53
+ shell : bash
54
+ run : cmake --build ${{ inputs.build_dir }} --target ${{ inputs.cmake_target }}
55
+
56
+ - name : Get docs version
57
+ id : get-docs-version
58
+ shell : bash
59
+ run : |
60
+ subdir=$(basename $(find ${{ inputs.build_dir }}/${{ inputs.docs_dir }} -mindepth 1 -maxdepth 1 -type d | head -n 1))
61
+ echo "version=$subdir" >> $GITHUB_OUTPUT
62
+
63
+ - name : Deploy docs
64
+ if : ${{ inputs.destination_dir != '' }}
65
+ uses : peaceiris/actions-gh-pages@v4
66
+ with :
67
+ github_token : ${{ inputs.github_token }}
68
+ publish_dir : ${{ inputs.build_dir }}/${{ inputs.docs_dir }}/${{ steps.get-docs-version.outputs.version }}
69
+ destination_dir : ${{ inputs.destination_dir }}
70
+ publish_branch : ${{ inputs.docs_branch }}
71
+
72
+ - name : Deploy docs
73
+ if : ${{ inputs.destination_dir == '' }}
74
+ uses : peaceiris/actions-gh-pages@v4
75
+ with :
76
+ github_token : ${{ inputs.github_token }}
77
+ publish_dir : ${{ inputs.build_dir }}/${{ inputs.docs_dir }}/${{ steps.get-docs-version.outputs.version }}
78
+ destination_dir : ${{ steps.get-docs-version.outputs.version }}
79
+ publish_branch : ${{ inputs.docs_branch }}
0 commit comments