Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: docgen proto with protoc-gen-doc #557

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,21 @@ jobs:
name: JSON-Schema-documentation
path: docgen/json/docs
if-no-files-found: error
docs_proto:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docgen/proto
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v4
- name: Generate Schema documentation
run: ./gen.sh
- name: Archive Schema documentation
# https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
with:
name: PROTO-Schema-documentation
path: docgen/proto/docs
if-no-files-found: error
1 change: 1 addition & 0 deletions docgen/proto/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/docs/
41 changes: 41 additions & 0 deletions docgen/proto/gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
set -eu

THIS_PATH="$(realpath "$(dirname "$0")")"
SCHEMA_PATH="$(realpath "$THIS_PATH/../../schema")"
DOCS_PATH="$THIS_PATH/docs"
TEMPLATES_PATH="$THIS_PATH/templates"

PROTOC_GEN_DOC_VERSION='1.5.1'

# --

rm -f -R "$DOCS_PATH"
mkdir -p "$DOCS_PATH/"{1.3,1.4,1.5,1.6}

generate () {
version="$1"
title="CycloneDX v$version Proto Reference"
echo "Generating: $title"

## docs: https://github.com/pseudomuto/protoc-gen-doc
docker run --rm \
-v "${DOCS_PATH}/${version}:/out" \
-v "${SCHEMA_PATH}:/protos:ro" \
-v "${TEMPLATES_PATH}:/templates:ro" \
"pseudomuto/protoc-gen-doc:${PROTOC_GEN_DOC_VERSION}" \
--doc_opt=/templates/html.tmpl,index.html \
"bom-${version}.proto"

# fix file permissions
docker run --rm \
-v "${DOCS_PATH}/${version}:/out" \
--entrypoint chown \
"pseudomuto/protoc-gen-doc:${PROTOC_GEN_DOC_VERSION}" \
"$(id -g):$(id -u)" -R /out
}

generate 1.3
generate 1.4
generate 1.5
generate 1.6
Loading
Loading