-
Notifications
You must be signed in to change notification settings - Fork 95
78 lines (67 loc) · 2.71 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
name: Update Protobufs
on:
workflow_dispatch: {}
schedule:
- cron: '0 0 * * *'
jobs:
protobuf:
name: Update Protobufs
runs-on: ubuntu-latest
env:
GameTracking_dir: /tmp/GameTracking-CSGO
steps:
- uses: actions/checkout@v2
- name: Download latest Protobufs
run: |
git clone --depth=1 https://github.com/SteamDatabase/GameTracking-CSGO.git $GameTracking_dir
cp $GameTracking_dir/Protobufs/{cstrike15_*.proto,engine_gcmessages.proto,netmessages.proto,steammessages.proto,gcsdk_gcmessages.proto,networkbasetypes.proto,network_connection.proto} pkg/demoinfocs/msg/proto
if [[ ! `git status --porcelain` ]]; then
echo "PROTOBUFS_CHANGED=false" >> $GITHUB_ENV
exit 0
else
echo "PROTOBUFS_CHANGED=true" >> $GITHUB_ENV
fi
- name: Install Go
if: env.PROTOBUFS_CHANGED == 'true'
uses: actions/setup-go@v2
with:
go-version: 1.18.x
- name: Install Protobuf tools
if: env.PROTOBUFS_CHANGED == 'true'
run: |
sudo apt-get update
sudo apt-get install unzip
wget -O /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.3/protoc-21.3-linux-x86_64.zip
unzip /tmp/protoc.zip -d /tmp/protoc
go install google.golang.org/protobuf/cmd/[email protected]
- name: Generate Go code
if: env.PROTOBUFS_CHANGED == 'true'
run: |
cd pkg/demoinfocs/msg
export PATH=/tmp/protoc/bin:$PATH
./generate.sh
- name: Commit changes
if: env.PROTOBUFS_CHANGED == 'true'
run: |
commit_sha=$(pushd $GameTracking_dir > /dev/null && git rev-parse HEAD && popd > /dev/null)
echo "COMMIT_SHA=$commit_sha" >> $GITHUB_ENV
- name: Create Pull Request
id: pr
if: env.PROTOBUFS_CHANGED == 'true'
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
title: "protobuf: updated to ${{ env.COMMIT_SHA }}"
base: master
branch: update-protobufs
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
commit-message: |
protobuf: updated to ${{ env.COMMIT_SHA }}
see https://github.com/SteamDatabase/GameTracking-CSGO
body: |
see https://github.com/SteamDatabase/GameTracking-CSGO
- name: Print PR outputs
if: env.PROTOBUFS_CHANGED == 'true'
run: |
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
echo "Pull Request Number - ${{ steps.pr.outputs.pull-request-number }}"