diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..1ff3e26 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 + diff --git a/Makefile b/Makefile index f324fd8..b1c82e6 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ $(BIN)/gofumpt: Makefile | $(BIN) $(TOOL_INSTALL) mvdan.cc/gofumpt@v0.4.0 $(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/v4@v4.30.8 diff --git a/src/LICENSE b/src/LICENSE new file mode 120000 index 0000000..ea5b606 --- /dev/null +++ b/src/LICENSE @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/src/buf.yaml b/src/buf.yaml new file mode 100644 index 0000000..2d71a8d --- /dev/null +++ b/src/buf.yaml @@ -0,0 +1,8 @@ +version: v1 +name: buf.build/planetscale/vitess +breaking: + use: + - FILE +lint: + use: + - DEFAULT