mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-12-24 08:12:55 +08:00
gitee流水线
This commit is contained in:
62
.workflow/pipeline-admin.yml
Normal file
62
.workflow/pipeline-admin.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
version: '1.0'
|
||||
name: pipeline-admin
|
||||
displayName: pipeline-admin
|
||||
triggers:
|
||||
trigger: manual
|
||||
push:
|
||||
branches:
|
||||
prefix:
|
||||
- dev
|
||||
stages:
|
||||
- name: stage-c475b4e4
|
||||
displayName: 前端打包
|
||||
strategy: naturally
|
||||
trigger: auto
|
||||
executor: []
|
||||
steps:
|
||||
- step: build@nodejs
|
||||
name: build_nodejs
|
||||
displayName: Nodejs 构建
|
||||
nodeVersion: 21.5.0
|
||||
commands:
|
||||
- '# 设置NPM源,提升安装速度'
|
||||
- npm config set registry https://registry.npmmirror.com
|
||||
- npm i -g pnpm
|
||||
- cd admin
|
||||
- '# 执行编译命令'
|
||||
- pnpm i
|
||||
- pnpm run prod
|
||||
artifacts:
|
||||
- name: BUILD_Admin
|
||||
path:
|
||||
- ./admin/dist
|
||||
caches:
|
||||
- ~/.npm
|
||||
- ~/.yarn
|
||||
- ~/.pnpm-store
|
||||
notify: []
|
||||
strategy:
|
||||
retry: '0'
|
||||
- step: deploy@agent
|
||||
name: deploy_admin
|
||||
displayName: 主机部署
|
||||
hostGroupID:
|
||||
ID: tengxun_qingliang
|
||||
hostID:
|
||||
- fee90b81-14b8-4170-915d-3da3f413a812
|
||||
deployArtifact:
|
||||
- source: build
|
||||
name: admin
|
||||
target: ~/gitee_go/deploy
|
||||
dependArtifact: BUILD_Admin
|
||||
script:
|
||||
- '# 功能:部署脚本会在部署主机组的每台机器上执行'
|
||||
- '# 使用场景:先将制品包解压缩到指定目录中,再执行启动脚本deploy.sh,脚本示例地址:https://gitee.com/gitee-go/spring-boot-maven-deploy-case/blob/master/deploy.sh'
|
||||
- mkdir -p /www/wwwroot/likeadmin/web
|
||||
- tar zxvf ~/gitee_go/deploy/admin.tar.gz -C /www/wwwroot/likeadmin/web
|
||||
- ''
|
||||
- echo '后台前端部署完成'
|
||||
notify: []
|
||||
strategy:
|
||||
retry: '0'
|
||||
dependsOn: build_nodejs
|
||||
61
.workflow/pipeline-go.yml
Normal file
61
.workflow/pipeline-go.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
version: '1.0'
|
||||
name: pipeline-go
|
||||
displayName: pipeline-go
|
||||
triggers:
|
||||
trigger: manual
|
||||
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 4
|
||||
- echo 'Go部署完成'
|
||||
notify: []
|
||||
strategy:
|
||||
retry: '0'
|
||||
dependsOn: build_golang
|
||||
Reference in New Issue
Block a user