Skip to content

Commit

Permalink
Designate buf module to push to registry
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrobenolt committed Dec 11, 2023
1 parent a4a7c0c commit b7e34d4
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: publish

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
publish:
name: publish buf module
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: setup go
uses: actions/setup-go@v4
with:
go-version: '^1.21'

- name: install buf
run: make bin/buf

- name: login to BSR
env:
BUF_USER: ${{ vars.BUF_USER }}
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
run: |
echo "$BUF_TOKEN" | bin/buf registry login --username "$BUF_USER" --token-stdin
- name: publish to BSR main
if: ${{ github.ref == 'refs/heads/main' }}
run: bin/buf push -v src


- name: publish to BSR branch
if: ${{ github.ref != 'refs/heads/main' }}
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: bin/buf push -v --branch "$BRANCH_NAME" src

- name: logout BSR
run: bin/buf registry logout

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $(BIN)/gofumpt: Makefile | $(BIN)
$(TOOL_INSTALL) mvdan.cc/[email protected]

$(BIN)/buf: Makefile | $(BIN)
$(TOOL_INSTALL) github.com/bufbuild/buf/cmd/buf@v1.26.1
$(TOOL_INSTALL) github.com/bufbuild/buf/cmd/buf@v1.28.1

$(BIN)/yq: Makefile | $(BIN)
$(TOOL_INSTALL) github.com/mikefarah/yq/[email protected]
Expand Down
1 change: 1 addition & 0 deletions src/LICENSE
8 changes: 8 additions & 0 deletions src/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
name: buf.build/planetscale/vitess
breaking:
use:
- FILE
lint:
use:
- DEFAULT

0 comments on commit b7e34d4

Please sign in to comment.