| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- ##############################
- # 测试环境部署
- ##############################
- kind: pipeline
- type: docker
- name: test-omega-admin
- volumes: # 声明数据卷
- - name: node_modules # 数据卷名称
- # Host Volume, 挂载到宿主机上的卷轴
- host:
- # 宿主机的绝对路径
- path: /home/ABServer/drone/cache/node_modules/test-omega-admin
- - name: targetDir
- host:
- path: /home/ABServer/drone/webroot/test-omega-admin
- - name: shellDir
- host:
- path: /home/ABServer/drone/config/shell
- - name: configDir
- host:
- path: /home/ABServer/drone/config/ossConfig
- - name: timezone
- host:
- path: /etc/localtime
- clone:
- disable: false
- steps:
- - name: build-project
- image: node:22-alpine
- pull: if-not-exists
- depends_on: [clone] # 依赖的步骤
- volumes: # 挂载数据卷
- - name: node_modules # 数据卷名称
- path: /drone/src/node_modules/ # 容器内目录 绝对路径
- - name: timezone
- path: /etc/localtime
- commands: # 执行命令
- - npm config set registry https://registry.npmmirror.com # 切换淘宝镜像
- - npm install -g pnpm@10.33.0
- - pnpm install --frozen-lockfile # 安装node_modules包
- - rm -rf dist
- - pnpm build:test # 执行编译
- - ls -al
- when:
- status:
- - success # 当前步骤成功时执行
- - name: deploy-project
- image: eclipse/alpine_jdk8
- user: root
- pull: if-not-exists
- depends_on: [build-project] # 依赖的步骤
- volumes: # 挂载数据卷
- - name: targetDir
- path: /deploy-target
- - name: shellDir
- path: /config/shell
- - name: configDir
- path: /root
- commands: # 执行命令
- - ls -al /drone/src/
- - cp -r /drone/src/dist/* /deploy-target/
- - chmod +x /config/shell/install.sh && /config/shell/install.sh
- - ossutil64 cp -rf /deploy-target/ oss://test-omega-admin
- trigger:
- branch:
- include:
- - test-omega-admin
- event:
- include:
- - push
- ##############################
- # 生产环境部署
- ##############################
- ---
- kind: pipeline
- type: docker
- name: release-omega-admin
- volumes: # 声明数据卷
- - name: node_modules # 数据卷名称
- # Host Volume, 挂载到宿主机上的卷轴
- host:
- # 宿主机的绝对路径
- path: /home/ABServer/drone/cache/node_modules/release-omega-admin
- - name: targetDir
- host:
- path: /home/ABServer/drone/webroot/release-omega-admin
- - name: shellDir
- host:
- path: /home/ABServer/drone/config/shell
- - name: configDir
- host:
- path: /home/ABServer/drone/config/ossConfig
- - name: timezone
- host:
- path: /etc/localtime
- clone:
- disable: false
- steps:
- - name: build-project
- image: node:22-alpine
- pull: if-not-exists
- depends_on: [clone] # 依赖的步骤
- volumes: # 挂载数据卷
- - name: node_modules # 数据卷名称
- path: /drone/src/node_modules/ # 容器内目录 绝对路径
- - name: timezone
- path: /etc/localtime
- commands: # 执行命令
- - npm config set registry https://registry.npmmirror.com # 切换淘宝镜像
- - npm install -g pnpm@10.33.0
- - pnpm install --frozen-lockfile # 安装node_modules包
- - rm -rf dist
- - pnpm build # 执行编译
- - ls -al
- when:
- status:
- - success # 当前步骤成功时执行
- - name: deploy-project
- image: eclipse/alpine_jdk8
- user: root
- pull: if-not-exists
- depends_on: [build-project] # 依赖的步骤
- volumes: # 挂载数据卷
- - name: targetDir
- path: /deploy-target
- - name: shellDir
- path: /config/shell
- - name: configDir
- path: /root
- commands: # 执行命令
- - ls -al /drone/src/
- - cp -r /drone/src/dist/* /deploy-target/
- - chmod +x /config/shell/install.sh && /config/shell/install.sh
- - ossutil64 cp -rf /deploy-target/ oss://omega-admin
- trigger:
- branch:
- include:
- - release-omega-admin
- event:
- include:
- - push
|