-
Notifications
You must be signed in to change notification settings - Fork 598
130 lines (125 loc) · 4.66 KB
/
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
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
name: Build Documentation
on:
push:
branches: [ros2]
pull_request:
branches: [ros2]
workflow_dispatch:
env:
WORKSPACE_PATH: ros_ws/src/usb_cam
DOXYGEN_ARTIFACT: doxygen_xml
DOXYBOOK_ARTIFACT: api_reference
DOXYBOOK_VERSION: v1.4.0
# only run one build doc workflow at a time, cancel any running ones
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-doxygen:
runs-on: ubuntu-latest
steps:
- name: Make sure output directory exists
run: mkdir -p ${{ env.WORKSPACE_PATH }}
- name: Checkout repository
uses: actions/checkout@v2
with:
path: ${{ env.WORKSPACE_PATH }}
- name: Generate doxygen and upload as artifact
# TODO: figure out way to use WORKSPACE_PATH var here
uses: ./ros_ws/src/usb_cam/.github/actions/generate-doxygen
with:
working-directory: ${{ env.WORKSPACE_PATH }}
doxyfile-path: 'docs/doxygen.config'
artifact-path: ${{ env.WORKSPACE_PATH }}/docs/xml
artifact-name: ${{ env.DOXYGEN_ARTIFACT }}
artifact-retention-days: 30
generate-doxybook2:
runs-on: ubuntu-latest
needs: generate-doxygen
steps:
- name: Make sure output directory exists
run: mkdir -p ${{ env.WORKSPACE_PATH }}
- name: Checkout repository
uses: actions/checkout@v2
with:
path: ${{ env.WORKSPACE_PATH }}
- name: Generate API reference and upload as artifact
# TODO: figure out way to use WORKSPACE_PATH var here
uses: ./ros_ws/src/usb_cam/.github/actions/generate-doxybook
with:
input-doxygen-artifact: ${{ env.DOXYGEN_ARTIFACT }}
doxygen-artifact-extraction-path: ${{ env.WORKSPACE_PATH }}/docs/xml
doxybook2-version: ${{ env.DOXYBOOK_VERSION }}
doxybook2-config-path: ${{ env.WORKSPACE_PATH }}/docs/doxybook2_config.json
output-path: ${{ env.WORKSPACE_PATH }}/docs/api-reference
base-url: /usb_cam/latest/api-reference/
artifact-path: ${{ env.WORKSPACE_PATH }}/docs/api-reference
artifact-name: ${{ env.DOXYBOOK_ARTIFACT }}
artifact-retention-days: 30
build-mkdocs:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/ros2'
needs: generate-doxybook2
steps:
- name: Make sure output directory exists
run: mkdir -p ${{ env.WORKSPACE_PATH }}
- name: Checkout repository
uses: actions/checkout@v2
with:
path: ${{ env.WORKSPACE_PATH }}
- name: Download API Reference
uses: actions/download-artifact@v3
with:
name: ${{ env.DOXYBOOK_ARTIFACT }}
path: ${{ env.WORKSPACE_PATH }}/docs/api-reference
- name: Build mkdocs site
run: |
cd ${{ env.WORKSPACE_PATH }}
# ensure gh-pages git history is fetched
git fetch origin gh-pages --depth=1
sudo apt-get update -y
# install mkdocs dependencies
python3 -m pip install -r docs/requirements.txt
# build site
mkdocs build
- name: Upload docs site
uses: actions/upload-artifact@v3
with:
name: usb_cam_site
path: ${{ env.WORKSPACE_PATH }}/site
deploy_docs:
runs-on: ubuntu-latest
# only run on main ros2 branch after jobs listed in `needs` have finished (successful or not)
if: github.ref == 'refs/heads/ros2' && always()
needs: [build-mkdocs]
steps:
- name: Make sure output directory exists
run: mkdir -p ${{ env.WORKSPACE_PATH }}
- name: Checkout repository
uses: actions/checkout@v2
with:
path: ${{ env.WORKSPACE_PATH }}
- name: Download API reference
uses: actions/download-artifact@v3
with:
name: ${{ env.DOXYBOOK_ARTIFACT }}
path: ${{ env.WORKSPACE_PATH }}/docs/api-reference
- name: Deploy mkdocs site
shell: bash
run: |
cd ${{ env.WORKSPACE_PATH }}
# ensure gh-pages git history is fetched
git fetch origin gh-pages --depth=1
sudo apt-get update -y
# install docs dependencies
python3 -m pip install -r docs/requirements.txt
# TODO: mike rebuilds entire site, instead we should
# skip the build and download site artifact from previous workflow
if [ -z ${{ github.event.release.tag_name }}]; then
export NEW_VERSION=main
else
export NEW_VERSION=${{ github.event.release.tag_name }}
fi
git config user.name doc-bot
git config user.email doc-bot@usb_cam.com
mike deploy --push --update-aliases $NEW_VERSION latest