Skip to content

Commit 55dc0ef

Browse files
committed
docs: docgen proto with protoc-gen-doc
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent fcc722d commit 55dc0ef

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

.github/workflows/build_docs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,21 @@ jobs:
5959
name: JSON-Schema-documentation
6060
path: docgen/json/docs
6161
if-no-files-found: error
62+
docs_proto:
63+
runs-on: ubuntu-latest
64+
defaults:
65+
run:
66+
working-directory: docgen/proto
67+
steps:
68+
- name: Checkout
69+
# see https://github.com/actions/checkout
70+
uses: actions/checkout@v4
71+
- name: Generate Schema documentation
72+
run: ./gen.sh
73+
- name: Archive Schema documentation
74+
# https://github.com/actions/upload-artifact
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: PROTO-Schema-documentation
78+
path: docgen/proto/docs
79+
if-no-files-found: error

docgen/proto/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/docs/

docgen/proto/gen.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
THIS_PATH="$(realpath "$(dirname "$0")")"
5+
SCHEMA_PATH="$(realpath "$THIS_PATH/../../schema")"
6+
DOCS_PATH="$THIS_PATH/docs"
7+
TEMPLATES_PATH="$THIS_PATH/templates"
8+
9+
PROTOC_GEN_DOC_VERSION='1.5.1'
10+
11+
# --
12+
13+
rm -f -R "$DOCS_PATH"
14+
mkdir -p "$DOCS_PATH/"{1.3,1.4,1.5,1.6}
15+
16+
generate () {
17+
version="$1"
18+
19+
## docs: https://github.com/pseudomuto/protoc-gen-doc
20+
docker run --rm \
21+
-v "${DOCS_PATH}/${version}:/out" \
22+
-v "${SCHEMA_PATH}:/protos:ro" \
23+
-v "${TEMPLATES_PATH}:/templates:ro" \
24+
"pseudomuto/protoc-gen-doc:${PROTOC_GEN_DOC_VERSION}" \
25+
--doc_opt=html,index.html \
26+
"bom-${version}.proto"
27+
28+
# fix file permissions
29+
docker run --rm \
30+
-v "${DOCS_PATH}/${version}:/out" \
31+
--entrypoint chown \
32+
"pseudomuto/protoc-gen-doc:${PROTOC_GEN_DOC_VERSION}" \
33+
"$(id -g):$(id -u)" -R /out
34+
}
35+
36+
generate 1.3
37+
generate 1.4
38+
generate 1.5
39+
generate 1.6

0 commit comments

Comments
 (0)