ci(gen): buf generate up to date #309
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: check buf generate up to date | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: load env Go 1.22 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
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 '[email protected]' | |
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 |