Skip to content

Generate Protobuf Documentation #5

Generate Protobuf Documentation

Generate Protobuf Documentation #5

Workflow file for this run

name: Generate Protobuf Documentation
# Define a manual trigger with input for version
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Install dependencies for protoc
- name: Install protoc dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler curl
# Step 3: Download precompiled protoc-gen-doc binary
- name: Download protoc-gen-doc binary
run: |
# Download the appropriate precompiled binary for Linux
curl -L -o protoc-gen-doc https://github.com/pseudomuto/protoc-gen-doc/releases/download/v1.5.1/protoc-gen-doc-1.5.1.linux-amd64
# Make it executable
chmod +x protoc-gen-doc
# Move the binary to /usr/local/bin
sudo mv protoc-gen-doc /usr/local/bin/
# Step 4: Generate Markdown from the Protobuf file
- name: Generate Protobuf Documentation
run: |
# Generate markdown from .proto file
protoc --doc_out=./idl --doc_opt=markdown,protobuf.md ./idl/grpc/service.proto
# Step 5: Configure Git and commit the updated protobuf.md
- name: Configure Git
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
# Step 6: Commit and push the changes
- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add ./idl/protobuf.md
git commit -m "Update protobuf documentation"
git push