chore(kb): refactor kb endpoints (#371) #382
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push and Generate buf | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
push-buf: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: bufbuild/buf-setup-action@v1 | |
- uses: bufbuild/buf-push-action@v1 | |
with: | |
buf_token: ${{ secrets.botBufToken }} | |
gen-buf-protogen-go: | |
runs-on: ubuntu-latest | |
needs: push-buf | |
steps: | |
- uses: bufbuild/buf-setup-action@v1 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Checkout protobuf repository | |
uses: actions/checkout@v3 | |
- name: Checkout protogen-go repository | |
uses: actions/checkout@v3 | |
with: | |
repository: instill-ai/protogen-go | |
path: ./protogen-go | |
token: ${{ secrets.botGitHubToken }} | |
- name: Import GPG Key | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.botGPGPrivateKey }} | |
passphrase: ${{ secrets.botGPGPassphrase }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_tag_gpgsign: true | |
workdir: ./protogen-go | |
- name: Generate Go/gRPC/gRPC-Gateway client and server stubs, and commit to protogen-go repository | |
run: | | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | |
buf generate | |
cwd=$(pwd) && cd gen/go && ls -d */ | xargs -I{} rm -rf $cwd/protogen-go/{} && cd $cwd | |
cp -r gen/go/* protogen-go/ | |
cd protogen-go | |
if [[ `git status --porcelain` ]]; then | |
git add * | |
git commit -S -m "chore: auto-gen by protobufs" -m "triggered by commit: https://github.com/instill-ai/protobufs/commit/${GITHUB_SHA}" | |
git push | |
fi | |
gen-buf-protogen-python: | |
runs-on: ubuntu-latest | |
needs: push-buf | |
steps: | |
- uses: bufbuild/buf-setup-action@v1 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Checkout protobuf repository | |
uses: actions/checkout@v3 | |
- name: Checkout protogen-python repository | |
uses: actions/checkout@v3 | |
with: | |
repository: instill-ai/protogen-python | |
path: ./protogen-python | |
token: ${{ secrets.botGitHubToken }} | |
- name: Import GPG Key | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.botGPGPrivateKey }} | |
passphrase: ${{ secrets.botGPGPassphrase }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_tag_gpgsign: true | |
workdir: ./protogen-python | |
- name: Generate Go/gRPC client and server stubs, and commit to protogen-python repository | |
run: | | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | |
buf generate | |
cwd=$(pwd) && cd gen/python && ls -d */ | xargs -I{} rm -rf $cwd/protogen-python/{} && cd $cwd | |
cp -r gen/python/* protogen-python/ | |
cd protogen-python | |
if [[ `git status --porcelain` ]]; then | |
git add * | |
git commit -S -m "chore: auto-gen by protobufs" -m "triggered by commit: https://github.com/instill-ai/protobufs/commit/${GITHUB_SHA}" | |
git push | |
fi |