-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpipeline-go.yml
61 lines (61 loc) · 1.77 KB
/
pipeline-go.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
53
54
55
56
57
58
59
60
61
version: '1.0'
name: pipeline-go
displayName: pipeline-go
triggers:
trigger: auto
push:
branches:
prefix:
- dev
stages:
- name: stage-fb64cace
displayName: go打包
strategy: naturally
trigger: auto
executor: []
steps:
- step: build@golang
name: build_golang
displayName: Golang 构建
golangVersion: '1.22'
commands:
- '# 默认使用goproxy.cn'
- export GOPROXY=https://goproxy.cn
- ''
- '# 输入你的构建命令'
- cd server
- go mod tidy
- go build -o ./x_admin
artifacts:
- name: BUILD_Go
path:
- ./server/x_admin
caches:
- /go/pkg/mod
notify: []
strategy:
retry: '0'
- step: deploy@agent
name: deploy_go
displayName: 主机部署-go
hostGroupID:
ID: tengxun_qingliang
hostID:
- fee90b81-14b8-4170-915d-3da3f413a812
deployArtifact:
- source: build
name: x_admin
target: ~/gitee_go/deploy
dependArtifact: BUILD_Go
script:
- '# 功能:部署脚本会在部署主机组的每台机器上执行'
- '# 使用场景:先将制品包解压缩到指定目录中,再执行启动脚本deploy.sh,脚本示例地址:https://gitee.com/gitee-go/spring-boot-maven-deploy-case/blob/master/deploy.sh'
- mkdir -p /www/wwwroot/likeadmin
- tar zxvf ~/gitee_go/deploy/x_admin.tar.gz -C /www/wwwroot/likeadmin
- '# sh /home/admin/app/deploy.sh restart'
- pm2 reload x_admin
- echo 'Go部署完成'
notify: []
strategy:
retry: '0'
dependsOn: build_golang