123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- kind: pipeline
- type: docker
- name: miniprogram-manager-prod
- volumes: # 声明数据卷
- - name: targetDir
- host:
- path: /miniprogram-manager
- clone:
- disable: false # 启用代码拉取
- steps:
- - name: build-project
- image: mcr.microsoft.com/dotnet/core/sdk:3.0-alpine
- pull: if-not-exists
- depends_on: [clone] # 依赖的步骤
- volumes: # 挂载数据卷
- - name: targetDir
- path: /drone/src/dist/
- commands: # 执行命令
- - echo '' > ~/.nuget/NuGet/NuGet.Config
- - echo '<?xml version="1.0" encoding="utf-8"?><configuration><packageSources><add key="nuget.org" value="https://nuget.cdn.azure.cn/v3/index.json" protocolVersion="3" /></packageSources></configuration>' > ~/.nuget/NuGet/NuGet.Config
- - rm -rf /drone/src/dist/*
- - dotnet publish -c release -o ./publish
- - cp -r ./publish/* /drone/src/dist # 复制文件
- when:
- status:
- - success # 当前步骤成功时执行
- - name: scp-project
- image: appleboy/drone-scp
- pull: if-not-exists
- depends_on: [build-project] # 依赖的步骤
- volumes: # 挂载数据卷
- - name: targetDir # 数据卷名称
- path: /miniprogram-manager # 容器内目录 绝对路径
- settings:
- host:
- from_secret: miniprogram-manager-host-a
- username:
- from_secret: username
- password:
- from_secret: userpwd
- port: 22
- command_timeout: 2m
- target: /home/ABServer/deploy-ready/
- source:
- - echo ====开始拷贝=======
- - /miniprogram-manager/*
- - echo ====结束拷贝=======
- when:
- status:
- - success # 当前步骤成功时执行
- - name: deploy-project
- image: appleboy/drone-ssh
- pull: if-not-exists
- depends_on: [scp-project] # 依赖的步骤
- settings:
- host:
- from_secret: miniprogram-manager-host-a
- username:
- from_secret: username
- password:
- from_secret: userpwd
- port: 22
- command_timeout: 2m
- script:
- - echo ====开始部署=======
- - cd /home/ABServer/
- - cp -r /home/ABServer/deploy-ready/miniprogram-manager /home/ABServer/webroot/
- - docker restart miniprogram-manager
- # - docker restart nodeServer1
- - echo ====部署成功=======
- - name: scp-project-b
- image: appleboy/drone-scp
- pull: if-not-exists
- depends_on: [build-project] # 依赖的步骤
- volumes: # 挂载数据卷
- - name: targetDir # 数据卷名称
- path: /miniprogram-manager # 容器内目录 绝对路径
- settings:
- host:
- from_secret: miniprogram-manager-host-b
- username:
- from_secret: username
- password:
- from_secret: userpwd
- port: 22
- command_timeout: 2m
- target: /home/ABServer/deploy-ready/
- source:
- - echo ====开始拷贝=======
- - /miniprogram-manager/*
- - echo ====结束拷贝=======
- when:
- status:
- - success # 当前步骤成功时执行
- - name: deploy-project-b
- image: appleboy/drone-ssh
- pull: if-not-exists
- depends_on: [scp-project] # 依赖的步骤
- settings:
- host:
- from_secret: miniprogram-manager-host-b
- username:
- from_secret: username
- password:
- from_secret: userpwd
- port: 22
- command_timeout: 2m
- script:
- - echo ====开始部署=======
- - cd /home/ABServer/
- - cp -r /home/ABServer/deploy-ready/miniprogram-manager /home/ABServer/webroot/
- - docker restart miniprogram-manager
- # - docker restart nodeServer1
- - echo ====部署成功=======
- trigger:
- branch:
- - release-miniprogram-manager
- event:
- - push
- #排除合并请求
- exclude:
- - ref: refs/pull/*
|