refactor variable name #3021
Workflow file for this run
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: main | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Build | |
if: "!contains(github.event.commits[0].message, 'ci skip')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup golang v1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.20' | |
- name: Build all | |
env: | |
DEPLOYER_TOKEN: ${{secrets.GH_TOKEN}} | |
run: | | |
git submodule update --init --recursive | |
git submodule update --remote --merge | |
pip3 install grpcio | |
pip3 install grpcio-tools | |
PB_REL="https://github.com/protocolbuffers/protobuf/releases" | |
curl -LO $PB_REL/download/v27.0/protoc-27.0-linux-x86_64.zip | |
unzip protoc-27.0-linux-x86_64.zip -d $HOME/.local | |
curl -LO https://github.com/bufbuild/buf/releases/download/v1.32.2/buf-Linux-x86_64.tar.gz | |
tar xvzf buf-Linux-x86_64.tar.gz && cp buf/bin/* $HOME/.local/bin/ | |
export GO111MODULE=on | |
echo 'Go environment:' && go env | |
curl -LO https://github.com/grpc/grpc-go/releases/download/cmd%2Fprotoc-gen-go-grpc%2Fv1.4.0/protoc-gen-go-grpc.v1.4.0.linux.amd64.tar.gz | |
tar xvzf protoc-gen-go-grpc.v1.4.0.linux.amd64.tar.gz && cp protoc-gen-go-grpc $HOME/.local/bin/ | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest \ | |
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest | |
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest | |
export PATH="$PATH:$HOME/.local/bin:$(go env GOPATH)/bin" | |
echo 'Build tool versions:' && protoc --version && protoc-gen-go --version | |
# Hack: I don't know how to setup go_package properly when importing protos via submodule so resort to good old sed: | |
grep -rl 'tobereplaced"' | xargs sed -i -e 's/tobereplaced"/protos"/g' | |
# Start build: | |
mkdir -p generated/py && chmod +x ./build.sh && ./build.sh | |
if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then | |
exit 0 | |
fi | |
# Update blue-sdk-go: | |
WORKSPACE_ROOT=$PWD | |
# Hack: I don't know how to setup go_package properly when importing protos via submodule so resort to good old sed: | |
grep -rl 'alphauslabs/protos' generated/go/ | xargs sed -i -e 's/alphauslabs\/protos/alphauslabs\/blue-sdk-go\/protos/g' | |
cd /tmp/ && git clone https://github.com/alphauslabs/blue-sdk-go && cd blue-sdk-go/ | |
cp -rv $WORKSPACE_ROOT/generated/index.html docs/ | |
cp -rv $WORKSPACE_ROOT/generated/go/* . && git status | |
git config user.email "[email protected]" | |
git config user.name "mobingideployer" | |
git add . && git commit -am "$GITHUB_REF $GITHUB_SHA" || true | |
git remote add origin-tmp https://[email protected]/alphauslabs/blue-sdk-go.git > /dev/null 2>&1 | |
git push --set-upstream origin-tmp | |
# Update blue-sdk-python: | |
cd /tmp/ && git clone https://github.com/alphauslabs/blue-sdk-python && cd blue-sdk-python | |
cp -rv $WORKSPACE_ROOT/generated/py/alphausblue* . && git status | |
git config user.email "[email protected]" | |
git config user.name "mobingideployer" | |
git add . && git commit -am "$GITHUB_REF $GITHUB_SHA" || true | |
git remote add origin-tmp https://[email protected]/alphauslabs/blue-sdk-python.git > /dev/null 2>&1 | |
git push --set-upstream origin-tmp | |
# Update OpenAPI docs repo: | |
cd /tmp/ && git clone https://github.com/alphauslabs/blueapidocs && cd blueapidocs | |
cp $WORKSPACE_ROOT/openapiv2/apidocs.swagger.json ./apidocs.json && git status | |
curl -X POST 'https://converter.swagger.io/api/convert' -H 'accept: application/json' -H 'Content-Type: application/json' -d @apidocs.json | jq > ./openapiv3/apidocs.json | |
git config user.email "[email protected]" | |
git config user.name "mobingideployer" | |
git add . && git commit -am "[OpenAPI] $GITHUB_REF $GITHUB_SHA" || true | |
git remote add origin-tmp https://[email protected]/alphauslabs/blueapidocs.git > /dev/null 2>&1 | |
git push --set-upstream origin-tmp |