-
Notifications
You must be signed in to change notification settings - Fork 28
111 lines (97 loc) · 2.87 KB
/
protobuf.yml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Protobuf
on:
push:
tags:
- v*
branches:
- main
paths:
- "api/**"
- "Makefile"
- "docs/Makefile"
- ".github/workflows/protobuf.yml"
- "**/gen.sum"
- "**.pb.go"
- "**.gen.go"
- "**.gen.graphql"
- "**.gen.yml"
- "**.pb.go"
- "**/pb_test.go"
- "**/docs/*/api.md"
- "**/go.mod"
- "**/go.sum"
pull_request:
paths:
- "api/**"
- "Makefile"
- "docs/Makefile"
- ".github/workflows/protobuf.yml"
- "**/gen.sum"
- "**.pb.go"
- "**.gen.go"
- "**.gen.graphql"
- "**.gen.yml"
- "**.pb.go"
- "**/pb_test.go"
- "**/docs/*/api.md"
- "**/go.mod"
- "**/go.sum"
jobs:
gen-go-and-docs:
if: github.event_name == 'DISABLED' # need to fix it by removing docker for generation
name: Generate go protobuf and docs
runs-on: ubuntu-latest
container: bertytech/buf:1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow
run: git fetch --prune --unshallow
- name: Remove lock files
run: find . -name gen.sum -delete
- name: Load variables from file
uses: antifree/[email protected]
with:
filename: .github/workflows/utils/variables.json
- name: Setup asdf
uses: asdf-vm/actions/setup@v1
- name: Setup go
run: |
asdf plugin add golang
asdf install golang
echo "go_version=$(asdf current golang | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV
- name: Setup jq
run: |
asdf plugin add jq
asdf install jq
- name: Cache go modules
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-
- name: Fetch go modules
run: go mod download
- name: Generate docs
working-directory: docs
run: make generate_local
- name: Generate go protobuf
run: |
make generate_local
git checkout go.mod go.sum
- name: Check diff
run: |
git status | cat
git diff -w | cat
git diff-index -w --quiet HEAD --
- name: Prepare openapi documentation
working-directory: docs
run: make openapi.prepare
- name: Setup apiary
run: apk --no-cache add ruby-dev g++ && gem install apiaryio
- name: Upload API docs to apiary.io
env:
APIARY_API_KEY: "${{ secrets.APIARY_API_KEY }}"
if: ${{ env.APIARY_API_KEY != 0 }}
run: |
apiary publish --api-name=bertyprotocol --path="docs/.tmp/openapi/bertyprotocol.swagger.json" || true