Files
x_admin/.workflow/pipeline-go.yml
2024-07-24 13:32:12 +08:00

62 lines
1.8 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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