doc: add nRF5340 command #76
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Documentation Build | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
- 'v*-branch' | |
paths: | |
- '.github/workflows/docbuild.yml' | |
- '**.rst' | |
- '**/Kconfig' | |
- '**/sample.yaml' | |
- 'doc/**' | |
- 'include/**' | |
- 'doc/requirements.txt' | |
- 'scripts/tools-versions-*.yml' | |
- 'west.yml' | |
push: | |
branches: | |
- main | |
- 'v*-branch' | |
tags: | |
- v* | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
with: | |
path: ncs/nrf | |
fetch-depth: 0 | |
- name: cache-pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-doc-pip | |
- name: Install packages | |
run: | | |
sudo apt update | |
sudo apt-get install -y ninja-build mscgen plantuml | |
sudo snap install yq | |
DOXYGEN_VERSION=$(yq ".doxygen.version" ./ncs/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: ncs | |
run: | | |
sudo pip3 install -U setuptools wheel pip | |
pip3 install -r nrf/doc/requirements.txt | |
- name: West init and update | |
working-directory: ncs | |
run: | | |
west init -l nrf | |
west update | |
west zephyr-export | |
- name: Build documentation | |
working-directory: ncs/nrf | |
run: | | |
cmake -GNinja -Bdoc/_build -Sdoc | |
ninja -C doc/_build | |
- name: Prepare archive | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }} | |
working-directory: ncs/nrf | |
run: | | |
MONITOR="monitor_${{ github.run_id }}.txt" | |
ARCHIVE="doc_build_${{ github.run_id }}.zip" | |
# Create documentation upload files | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
echo "publish2 dev PR-${{ github.event.number }} ${ARCHIVE}" > "${MONITOR}" | |
echo "${{ github.event.number }}" > pr.txt | |
else | |
VERSION_REGEX="^v([0-9a-z\.\-]+)$" | |
if [[ ${GITHUB_REF#refs/tags/} =~ $VERSION_REGEX ]]; then | |
VERSION=${BASH_REMATCH[1]} | |
elif [[ ${GITHUB_REF#refs/heads/} == "main" ]]; then | |
VERSION="latest" | |
else | |
echo "Not a release or latest, skipping publish" | |
exit 0 | |
fi | |
echo "publish2 main ${VERSION} ${ARCHIVE}" > "${MONITOR}" | |
fi | |
# add zoomin metadata | |
cp doc/custom.properties doc/_build/html | |
sed -i 's/__VERSION__/'"${VERSION}"'/g' doc/_build/html/custom.properties | |
# add zoomin tags file | |
cp doc/tags.yml doc/_build/html | |
sed -i 's/__VERSION__/'"${VERSION}"'/g' doc/_build/html/tags.yml | |
# compress | |
cd doc/_build/html | |
zip -rq "${ARCHIVE}" . | |
mv "${ARCHIVE}" ../../../ | |
- name: Store | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs | |
path: | | |
ncs/nrf/*.zip | |
ncs/nrf/monitor*.txt | |
ncs/nrf/pr.txt |