-
Notifications
You must be signed in to change notification settings - Fork 22
121 lines (101 loc) · 3.59 KB
/
docbuild.yml
File metadata and controls
121 lines (101 loc) · 3.59 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
name: Build Documentation
on:
pull_request:
branches:
- main
paths:
- 'docs/**'
- '.github/workflows/doc*'
- 'samples/**/*.rst'
permissions:
contents: read
concurrency:
group: "docs-build-${{ github.event.pull_request.number || github.ref }}"
cancel-in-progress: true
jobs:
Build_Documentation:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Get changed documentation files
id: changed-files
uses: ./.github/actions/get-changed-docs
with:
base_sha: ${{ github.event.pull_request.base.sha }}
head_sha: ${{ github.event.pull_request.head.sha }}
- name: Set up Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements-doc.txt
- name: Install Doxygen and mscgen
run: |
sudo apt-get update
sudo apt-get install -y doxygen mscgen
- name: Build Doxygen API documentation
run: |
cd docs
if [ -f Doxyfile ]; then
doxygen Doxyfile
fi
- name: Build Sphinx documentation
run: |
cd docs
sphinx-build -M html . _build_sphinx -W --keep-going
- name: Determine version
id: version
run: |
VERSION_REGEX="^v([0-9a-zA-Z\.\-]+)$"
VERSION="PR-${{ github.event.pull_request.number }}"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Prepare documentation archive
working-directory: docs/_build_sphinx/html
run: |
ARCHIVE="legacy-ncs-zigbee-${{ steps.version.outputs.VERSION }}.zip"
zip -rq "${ARCHIVE}" .
mv "${ARCHIVE}" ../../../
- name: Create monitor file
run: |
MONITOR="monitor_${{ github.run_id }}.txt"
VERSION="${{ steps.version.outputs.VERSION }}"
ARCHIVE="legacy-ncs-zigbee-${VERSION}.zip"
echo "publish2 dev ${VERSION} ${ARCHIVE}" > "${MONITOR}"
- name: Create PR info file
run: |
echo "${{ github.event.pull_request.number }}" > pr.txt
- name: Set deploy info
id: deploy-info
uses: ./.github/actions/set-deploy-info
with:
repo_owner: ${{ github.repository_owner }}
repo_name: ${{ github.event.repository.name }}
pr_number: ${{ github.event.pull_request.number }}
commit_sha: ${{ github.event.pull_request.head.sha }}
- name: Generate comment file
uses: ./.github/actions/generate-docs-comment
with:
preview_url: ${{ steps.deploy-info.outputs.preview_url }}
changed_docs: ${{ steps.changed-files.outputs.docs_files }}
build_timestamp: ${{ steps.deploy-info.outputs.build_timestamp }}
commit_sha: ${{ steps.deploy-info.outputs.commit_sha_short }}
- name: Rename comment file
run: mv comment.md comment.txt
- name: Upload documentation artifacts
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4
with:
name: doc-preview
path: |
*.zip
monitor_*.txt
pr.txt
comment.txt
retention-days: 7
if-no-files-found: error