Skip to content

Commit 3cc314e

Browse files
committed
docs: Integrate Aliro docs with Zoomin
- Add publish_documentation.yaml workflow for building and publishing docs to Zoomin. - Add on_push_publish_documentation.yaml to auto-publish on docs changes to main. - Add on_push_tag.yaml to publish release docs on version tags. - Add generate_docs.sh script for Sphinx-based doc generation. - Add custom.properties and tags.yml for Zoomin metadata. Signed-off-by: Konrad Grucel <konrad.grucel@nordicsemi.no>
1 parent ec0df88 commit 3cc314e

6 files changed

Lines changed: 161 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish latest documentation
2+
3+
on:
4+
workflow_dispatch:
5+
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- 'docs/**'
11+
12+
jobs:
13+
deploy:
14+
uses: ./.github/workflows/publish_documentation.yaml
15+
with:
16+
documentation_tag: "latest"
17+
publish_to_prod: true
18+
publish_to_dev: true
19+
secrets:
20+
NCS_ZOOMIN_KEY: ${{ secrets.NCS_ZOOMIN_KEY }}

.github/workflows/on_push_tag.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Publish release documentation
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
8+
jobs:
9+
build_documentation:
10+
uses: ./.github/workflows/publish_documentation.yaml
11+
secrets:
12+
NCS_ZOOMIN_KEY: ${{ secrets.NCS_ZOOMIN_KEY }}
13+
with:
14+
documentation_tag: ${{ github.ref_name }}
15+
publish_to_prod: true
16+
publish_to_dev: true
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Publish documentation
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
documentation_tag:
7+
type: string
8+
required: false
9+
default: "latest"
10+
description: "Label of the documentation"
11+
publish_to_prod:
12+
type: boolean
13+
default: true
14+
publish_to_dev:
15+
type: boolean
16+
default: true
17+
18+
workflow_call:
19+
inputs:
20+
documentation_tag:
21+
type: string
22+
required: true
23+
default: "latest"
24+
publish_to_prod:
25+
type: boolean
26+
default: true
27+
publish_to_dev:
28+
type: boolean
29+
default: true
30+
secrets:
31+
NCS_ZOOMIN_KEY:
32+
required: true
33+
34+
jobs:
35+
Publish_Documentation:
36+
env:
37+
DOCS_DIR: docs
38+
DOC_TAG: ${{ inputs.documentation_tag }}
39+
40+
runs-on: ubuntu-24.04
41+
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Set up Python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: '3.12'
52+
53+
- name: Build documentation
54+
env:
55+
ARCHIVE: "addon-aliro_${{ env.DOC_TAG }}.zip"
56+
run: |
57+
cd ${{env.DOCS_DIR}}
58+
./generate_docs.sh
59+
60+
cp custom.properties build/html/
61+
sed -i "s/__VERSION__/${DOC_TAG}/g" build/html/custom.properties
62+
63+
cp tags.yml build/html/
64+
sed -i "s/__VERSION__/${DOC_TAG}/g" build/html/tags.yml
65+
66+
cd build/html
67+
zip -rq "${ARCHIVE}" .
68+
69+
- name: Upload build artifacts
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: documentation
73+
path: ${{env.DOCS_DIR}}/build/html/addon-aliro_${{ env.DOC_TAG }}.zip
74+
75+
- name: Prepare Key
76+
env:
77+
NCS_ZOOMIN_KEY: ${{ secrets.NCS_ZOOMIN_KEY }}
78+
run: |
79+
mkdir -p ~/.ssh
80+
ssh-keyscan ${{ vars.NCS_ZOOMIN_SERVER }} >> ~/.ssh/known_hosts
81+
echo "$NCS_ZOOMIN_KEY" > zoomin_key
82+
chmod 600 zoomin_key
83+
84+
- name: Publish documentation - dev
85+
if: ${{ inputs.publish_to_dev }}
86+
env:
87+
ARCHIVE: "addon-aliro_${{ env.DOC_TAG }}.zip"
88+
run: |
89+
sftp -v -i zoomin_key ${{vars.NCS_ZOOMIN_USER}}@${{ vars.NCS_ZOOMIN_SERVER }} <<EOF
90+
cd ${{ vars.NCS_ZOOMIN_DEPLOY_DEV_PATH}}
91+
put ${{env.DOCS_DIR}}/build/html/${ARCHIVE}
92+
EOF
93+
94+
- name: Publish documentation - prod
95+
if: ${{ inputs.publish_to_prod }}
96+
env:
97+
ARCHIVE: "addon-aliro_${{ env.DOC_TAG }}.zip"
98+
run: |
99+
sftp -v -i zoomin_key ${{vars.NCS_ZOOMIN_USER}}@${{ vars.NCS_ZOOMIN_SERVER }} <<EOF
100+
cd ${{ vars.NCS_ZOOMIN_DEPLOY_PROD_PATH}}
101+
put ${{env.DOCS_DIR}}/build/html/${ARCHIVE}
102+
EOF

docs/custom.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
manual.name=addon-aliro-__VERSION__
2+
booktitle=nRF Door Lock and Access Control Add-on __VERSION__

docs/generate_docs.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
cd "$SCRIPT_DIR"
6+
7+
python3 -m venv .venv
8+
source ./.venv/bin/activate
9+
10+
pip install -r requirements.txt
11+
12+
sphinx-build -M html . build

docs/tags.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Document tags for Zoomin.
2+
3+
# Tags for all topics:
4+
mapping_global:
5+
- addon-aliro-__VERSION__
6+
- cluster-addon-aliro-__VERSION__
7+
8+
# Tags for individual topics:
9+
mapping_topics:

0 commit comments

Comments
 (0)