From a7f3479fcfeb60e64c56d988b0534a6b7b762226 Mon Sep 17 00:00:00 2001 From: BryantHe Date: Fri, 11 Aug 2023 16:39:20 +0800 Subject: [PATCH] chore: add drone yml --- .drone.yml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..9bc72eb --- /dev/null +++ b/.drone.yml @@ -0,0 +1,58 @@ +# drone 会按顺序执行 pipeline 配置中定义的任务 + +# main 分支在 build 和 PR 时执行的 pipeline +kind: pipeline +type: docker +name: main-pipeline + +platform: + os: linux + arch: amd64 + +trigger: + branch: + include: + - main + event: + include: + - custom + - push + +clone: + disable: true + +steps: +- name: deploy-k8s-master + image: appleboy/drone-ssh + settings: + host: + from_secret: k8s_master + username: ubuntu + key: + from_secret: k8s_key + port: 22 + script_stop: true + script: + - cd /var/www/pzx-web-api + - sudo git fetch + - sudo git reset --hard ${DRONE_COMMIT} + - sudo docker-compose down + - sudo docker-compose up -d --build --force-recreate + - sudo docker image prune -f +- name: deploy-k8s-worker + image: appleboy/drone-ssh + settings: + host: + from_secret: k8s_worker + username: ubuntu + key: + from_secret: k8s_key + port: 22 + script_stop: true + script: + - cd /var/www/pzx-web-api + - sudo git fetch + - sudo git reset --hard ${DRONE_COMMIT} + - sudo docker-compose down + - sudo docker-compose up -d --build --force-recreate + - sudo docker image prune -f \ No newline at end of file