Skip to content

ci(gen): buf generate up to date #245

ci(gen): buf generate up to date

ci(gen): buf generate up to date #245

Workflow file for this run

name: check buf generate up to date
on:
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: load Go 1.19 env
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- uses: actions/cache@v3
id: cache-golang
with:
path: |
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: echo ${{ steps.cache-golang.outputs.cache-hit }}
- name: init dependance
if: steps.cache-golang.outputs.cache-hit != 'true'
run: make install-tools
- name: generate proto
run: make generate-proto
- name: check if files up to date
run: |
if [[ `git status --porcelain` ]]; then
git config --global user.name 'FDKevin'
git config --global user.email 'fdkevinzero@gmail.com'
git add -A
git commit -m "ci(gen): buf generate up to date"
git push
fi
- name: warming go proxy
run: |
hash=$(git show -s --format=%h)
echo $hash
mkdir ~/warm
cd ~/warm
go mod init warm
go get github.com/hduhelp/api_open_sdk@$hash
GOPROXY=https://goproxy.io,direct go get github.com/hduhelp/api_open_sdk@$hash
GOPROXY=https://goproxy.cn,direct go get github.com/hduhelp/api_open_sdk@$hash