update CI workflow to install specific protoc version and enhance generated Protobufs handling
This commit is contained in:
1 parent
35d0739b63
commit
ce2c54acf2
3 files changed
+32
-13
No files matched your search
@@ -17,7 +17,7 @@ jobs:
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
ref: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
@@ -26,21 +26,37 @@ jobs:
|
||||
|
||||
- name: Install protoc
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y protobuf-compiler
|
||||
curl --fail --location --silent --show-error \
|
||||
--output "$RUNNER_TEMP/protoc.zip" \
|
||||
https://github.com/protocolbuffers/protobuf/releases/download/v36.2/protoc-36.2-linux-x86_64.zip
|
||||
unzip -q "$RUNNER_TEMP/protoc.zip" -d "$RUNNER_TEMP/protoc"
|
||||
echo "$RUNNER_TEMP/protoc/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Install protoc-gen-go
|
||||
run: |
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.12
|
||||
|
||||
- name: Generate Protobufs
|
||||
run: |
|
||||
make proto
|
||||
|
||||
- name: Commit and push changes
|
||||
env:
|
||||
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
run: |
|
||||
git config --global user.name "actions[bot]"
|
||||
git config --global user.email "noreply@beejay.kim"
|
||||
git add .
|
||||
git commit -m "Update generated Protobufs" || echo "No changes to commit"
|
||||
git push origin ${{ github.ref }} || echo "No changes to push"
|
||||
git add -- '*.pb.go'
|
||||
if git diff --cached --quiet; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$HEAD_REPOSITORY" != "$REPOSITORY" ]; then
|
||||
echo "::error::Generated protobufs are out of date. Run make proto and commit the changes."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git config user.name "actions[bot]"
|
||||
git config user.email "noreply@beejay.kim"
|
||||
git commit -m "Update generated Protobufs"
|
||||
git push origin "HEAD:refs/heads/$HEAD_REF"
|
||||
Reference in new issue
Block a user