Protobuf Development Workflow
Goal
Manage the local and CI development lifecycle for Protocol Buffers within the Liverty Music project.
Instructions
- •
Environment Setup:
- •Manager:
misemanages all tools. - •Install: Run
mise installin root. - •Hooks: Run
pre-commit install.
- •Manager:
- •
Local Development Loop:
- •Lint:
buf lint - •Format:
buf format -w - •Breaking Change:
buf breaking --against '.git#branch=main'
- •Lint:
- •
Pre-commit Hooks:
- •Commit:
buf lint,buf format, breaking change detection, prettier. - •Push: Schemas pushed to BSR for remote code generation.
- •Commit:
- •
CI/CD Pipeline:
- •PR Workflow (
.github/workflows/buf-pr-checks.yml):- •Runs on all PR events including label changes.
- •Validates: lint, format (
--diff --exit-code), breaking changes, dry-run generation. - •Skip Breaking Changes: Add
buf skip breakinglabel to PR to bypass breaking change detection.- •Used for intentional breaking changes (e.g., security fixes, MVP iterations).
- •Label must exist in repository (create with
gh label create "buf skip breaking"). - •Workflow automatically responds to
labeled/unlabeledevents. - •Reference: https://buf.build/docs/bsr/ci-cd/github-actions/#skip-breaking-change-detection-using-labels
- •Release Workflow (
.github/workflows/buf-release.yml):- •Triggers on GitHub releases.
- •Automatic
buf pushwith release tag as BSR label. - •Requires
BUF_TOKENsecret.
- •PR Workflow (
Constraints
- •Do NOT bypass
pre-commithooks. - •Do NOT use global
bufinstallation; usemiseversion. - •Do NOT run
buf generateEVER. Local generation is strictly forbidden to ensure consistency with BSR.
Example
bash
# Workflow for a new change mise install buf lint && buf format -w buf breaking --against '.git#branch=main' git add . git commit -m "feat: updates"