-
Notifications
You must be signed in to change notification settings - Fork 5
120 lines (105 loc) · 3.96 KB
/
docbuild.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
name: Documentation Build and reploy
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- 'v*-branch'
push:
branches:
- main
- 'v*-branch'
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout sources
uses: nrfconnect/action-checkout-west-update@main
with:
path: nrf70_bm_ws/nrf70-bm
- name: cache-pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-doc-pip
- name: Install packages
working-directory: nrf70_bm_ws
run: |
sudo apt update
sudo apt-get install -y ninja-build mscgen plantuml
sudo snap install yq
DOXYGEN_VERSION=$(yq ".doxygen.version" ./nrf/scripts/tools-versions-linux.yml)
wget --no-verbose "https://github.com/doxygen/doxygen/releases/download/Release_${DOXYGEN_VERSION//./_}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz"
tar xf doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz
echo "${PWD}/doxygen-${DOXYGEN_VERSION}/bin" >> $GITHUB_PATH
- name: Install Python dependencies
working-directory: nrf70_bm_ws
run: |
sudo pip3 install -U setuptools wheel pip
pip3 install -r nrf/doc/requirements.txt
- name: West zephyr-export
working-directory: nrf70_bm_ws
run: |
west zephyr-export
- name: Build documentation
working-directory: nrf70_bm_ws/nrf70-bm
run: ./build-docs.sh
- name: Prepare legacy upload
if: ${{ github.ref == 'refs/heads/main' || !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }}
working-directory: nrf70_bm_ws/nrf70-bm/nrf70_bm_lib
run: |
MONITOR="monitor_${{ github.run_id }}.txt"
# Create documentation upload files
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
ARCHIVE="nrf70-bm-docs-${{ github.event.number }}.zip"
echo "publish2 dev PR-${{ github.event.number }} ${ARCHIVE}" > "${MONITOR}"
echo "${{ github.event.number }}" > pr.txt
else
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
ARCHIVE="nrf70-bm-docs-main-$${{ github.sha }}.zip"
echo "publish2 main ${ARCHIVE}" > "${MONITOR}"
else
echo "Neither PR nor main branch, exiting"
exit 0
fi
fi
cd docs/build/html
zip -rq "${ARCHIVE}" .
mv "${ARCHIVE}" ../../../
- name: Store
if: ${{ github.ref == 'refs/heads/main' || !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }}
uses: actions/upload-artifact@v4
with:
name: docs
path: |
nrf70_bm_ws/nrf70-bm/nrf70_bm_lib/*.zip
nrf70_bm_ws/nrf70-bm/nrf70_bm_lib/monitor*.txt
nrf70_bm_ws/nrf70-bm/nrf70_bm_lib/pr.txt
- name: Setup pages
if: github.event_name != 'pull_request'
uses: actions/configure-pages@v4
- name: Upload pages artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v3
with:
path: nrf70_bm_ws/nrf70-bm/nrf70_bm_lib/docs/build/html
- name: Upload artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
path: nrf70_bm_ws/nrf70-bm/nrf70_bm_lib/docs/build/html
deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
permissions:
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4