-
Notifications
You must be signed in to change notification settings - Fork 13
69 lines (69 loc) · 2.48 KB
/
automatic-api-update.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
name: "Called update for API change"
on:
repository_dispatch:
types: ["api_update"]
jobs:
test:
name: "Create PR for API update"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: "Update Buf Script"
id: buf-update
uses: authzed/actions/buf-api-update@main
with:
api-commit: "${{ github.event.client_payload.BUFTAG }}"
spec-path: buf.gen.yaml
file-format: generate-shell-script
- name: "Output update status"
env:
UPDATED_STATUS: ${{ steps.buf-update.outputs.updated }}
run: |
echo "Update status: $UPDATED_STATUS"
- name: "Install ruby and dependencies"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "3.3.0"
bundler-cache: true
- name: "Update package version"
uses: authzed/actions/semver-update@main
if: steps.buf-update.outputs.updated == 'true'
with:
sourcefile-path: authzed.gemspec
version-regex: 's.version = "(.+)"'
version-change: minor
- name: "Update Gemfile"
run: |
bundle config unset deployment
bundle install
- name: "Install protoc"
uses: "arduino/setup-protoc@v3"
with:
version: "24.4"
- name: "Install Homebrew & gRPC"
run: |
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/runner/.bash_profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install grpc
which grpc_ruby_plugin
echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH
- name: "Install buf"
uses: "bufbuild/[email protected]"
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
if: steps.buf-update.outputs.updated == 'true'
- name: "Run buf generate"
if: steps.buf-update.outputs.updated == 'true'
run: |
./buf.gen.yaml
- name: Create Pull Request
uses: peter-evans/[email protected]
if: steps.buf-update.outputs.updated == 'true'
with:
delete-branch: "true"
title: "Update API to ${{ github.event.client_payload.BUFTAG }}"
branch: "api-change/${{ github.event.client_payload.BUFTAG }}"
token: ${{ secrets.GITHUB_TOKEN }}