-
Notifications
You must be signed in to change notification settings - Fork 4
94 lines (90 loc) · 3.33 KB
/
buf-push-gen.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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