-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (70 loc) · 2.13 KB
/
ci.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
name: CI
on:
push:
# Only run when there are changes under proto dir
paths:
- "proto/**"
- ".github/workflows/**"
pull_request:
# Only run when there are changes under proto dir
paths:
- "proto/**"
- ".github/workflows/**"
jobs:
# Run buf's lint to check for errros
buf-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1
- uses: bufbuild/buf-lint-action@v1
with:
input: "proto"
# Push the draft branch to buf.build
bsr-push-draft:
runs-on: ubuntu-latest
needs: buf-lint
if: github.ref == 'refs/heads/draft'
environment: draft
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1
- uses: bufbuild/buf-push-action@v1
with:
input: "proto"
draft: true
buf_token: ${{ secrets.BUF_BSR_TOKEN }}
# Generate and upload protodot diagrams
diagrams:
runs-on: ubuntu-latest
needs: buf-lint
if: github.ref == 'refs/heads/draft'
steps:
# Setup environment
- uses: actions/checkout@v4
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- name: Install librsvg2-bin
run: sudo apt-get install -y librsvg2-bin
# Generate diagrams
- name: Generate Diagrams
run: |
wget https://github.com/seamia/protodot/raw/master/binaries/protodot-linux-amd64
chmod +x protodot-linux-amd64
mkdir -v -p gen/bin
mv protodot-linux-amd64 gen/bin/protodot
export PATH=${PWD}/gen/bin:${PATH}
bash scripts/generate_protodot.sh
find gen/diagrams -type f -name "*.dot" -exec rm -f {} +
tree gen/diagrams
# Deploy diagrams
- name: Cloud Authentication
id: auth
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GOOGLE_CREDENTIALS }}"
- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Upload Diagrams
run: |
gsutil -m rsync -R -d gen/diagrams gs://docs-cmp-files/diagrams