Commit 17f99d7
committed
feat(proto): add Buf Schema Registry support
Add Buf (https://buf.build) support for managing and publishing myshoes protobuf definitions to Buf Schema Registry (BSR).
Changes:
- Add api/proto/buf.yaml for Buf configuration with lint rules
- Add api/proto/buf.gen.yaml for code generation settings
- Add .github/workflows/buf.yaml for CI/CD integration
- Update Makefile to use buf for proto code generation
- Add .buf/ to .gitignore
- Regenerate proto.go files using buf generate
This allows other projects (shoes plugins) to depend on myshoes proto definitions via BSR.
Manual steps required:
1. Create buf.build account and repository (buf.build/whywaita/myshoes)
2. Add BUF_TOKEN to GitHub Secrets
3. Run: cd api/proto && buf push
prompt: Implement the following plan: # myshoes proto を Buf Cloud (BSR) に公開する計画
----
計画内容を実装します。まず、タスクを整理してから作業を開始します。
実装が完了しました。以下のファイルを作成・更新しました:
## 作成したファイル
1. **api/proto/buf.yaml** - Buf の設定ファイル(lint と breaking change のルールを定義)
2. **api/proto/buf.gen.yaml** - コード生成の設定ファイル
3. **.github/workflows/buf.yaml** - GitHub Actions ワークフロー
## 更新したファイル
1. **Makefile** - `build-proto` を buf ベースに変更、`lint-proto` ターゲットを追加
2. **.gitignore** - `.buf/` を追加
3. **api/proto.go/myshoes.pb.go** - buf generate で再生成(protoc バージョン表示のみ変更)
4. **api/proto.go/myshoes_grpc.pb.go** - buf generate で再生成(protoc バージョン表示のみ変更)
## 動作確認
- `buf lint` - エラーなし
- `buf build` - 成功
- `make build` - 成功
- `make test` - すべてのテストが成功
## 次のステップ(手動作業が必要)
BSR に公開するためには、以下の手順を手動で行う必要があります:
1. **BSR アカウントのセットアップ**
- https://buf.build でアカウントを作成
- リポジトリ `buf.build/whywaita/myshoes` を作成
- API トークンを取得
- GitHub の Settings → Secrets and variables → Actions で `BUF_TOKEN` を登録
2. **初回プッシュ**
\`\`\`bash
cd api/proto && buf push
\`\`\`
3. **他のプロジェクトからの利用**
公開後、他のプロジェクトは以下のように依存できます:
\`\`\`yaml
# 依存先の buf.yaml
version: v2
deps:
- buf.build/whywaita/myshoes
\`\`\`1 parent d20faef commit 17f99d7
File tree
7 files changed
+56
-9
lines changed- .github/workflows
- api
- proto.go
- proto
7 files changed
+56
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 20 | + | |
| 21 | + | |
23 | 22 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 23 | + | |
| 24 | + | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments