Skip to content

Commit 7ea42bc

Browse files
authored
ci: publish proto schema to the Buf Schema Registry (#627)
* ci: publish proto module to BSR on push Adds a buf-push job that publishes proto/ to buf.build/authorizerdev/authorizer. Temporarily triggers on ci/buf-push to verify first publish; will narrow to main. * ci: add dedicated Buf workflow for proto schema Lint and breaking-change checks on PRs that touch proto/, and publish the module to buf.build/authorizerdev/authorizer on push to main. Keeps proto publishing out of the Go test/smoke pipeline.
1 parent c6d2b5c commit 7ea42bc

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/buf.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: Buf
3+
4+
# Proto schema CI for the `proto/` module (buf.build/authorizerdev/authorizer):
5+
# lint + breaking-change detection on PRs, publish to the BSR on push to main.
6+
on:
7+
pull_request:
8+
paths:
9+
- "proto/**"
10+
- ".github/workflows/buf.yml"
11+
push:
12+
branches: [main]
13+
paths:
14+
- "proto/**"
15+
- ".github/workflows/buf.yml"
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
buf:
22+
name: Lint, breaking & push
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
28+
29+
- uses: bufbuild/buf-setup-action@v1
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Lint
34+
run: buf lint proto
35+
36+
# Compare the proposed schema against the published module so a PR that
37+
# would break wire/source compatibility fails before it lands.
38+
- name: Breaking-change check
39+
run: buf breaking proto --against buf.build/authorizerdev/authorizer
40+
env:
41+
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
42+
43+
# Publish only from main. buf de-dupes identical schemas, so commits that
44+
# don't touch protos are no-ops.
45+
- name: Push to BSR
46+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
47+
run: buf push proto
48+
env:
49+
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}

0 commit comments

Comments
 (0)