-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (50 loc) · 1.94 KB
/
backend-blog-service.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
name: 构建 blog 服务
on:
push:
branches: [master]
paths:
- "golang/gw/proto/blog/**"
- "golang/gw/proto/scripts/**"
- "golang/gw/service/blog/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v5
with:
go-version: "1.21.5"
- name: 安装 protoc-gen-go/grpc/grpc-gateway/openapiv2 插件
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
- name: 生成桩文件
run: |
export PATH="$PATH:$(go env GOPATH)/bin"
cd golang/gw
./build.sh proto
- name: 构建二进制
run: |
cd golang/gw/
go build -o gw service/blog/main.go
- name: 构建镜像推送到 aliyun
run: |
docker version
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }} registry.cn-hangzhou.aliyuncs.com
cd golang/gw
chmod +x ./gw
docker build . --file docker/service/Dockerfile --tag registry.cn-hangzhou.aliyuncs.com/alomerry/mix-blog:latest
docker push registry.cn-hangzhou.aliyuncs.com/alomerry/mix-blog:latest
# https://github.com/marketplace/actions/http-request-action
- name: trigger rollout restart
uses: fjogeleit/http-request-action@v1
with:
url: ${{secrets.MIX_GW_RESTART_URL}}
method: "POST"
customHeaders: '{"Content-Type": "application/json"}'
data: '{"namespace": "alomerry", "deployment": "mix-module-blog-deployment"}'