2022-06-14 16:10:00 +08:00
|
|
|
# drone 会自动先拉取代码
|
|
|
|
# 再按顺序执行 pipeline 配置中定义的任务
|
|
|
|
|
2022-06-14 16:12:58 +08:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2023-07-09 02:26:34 +08:00
|
|
|
name: feature
|
2022-06-14 16:12:58 +08:00
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
2023-07-09 02:26:34 +08:00
|
|
|
trigger:
|
|
|
|
branch:
|
|
|
|
include:
|
|
|
|
- feature/*
|
|
|
|
|
|
|
|
clone:
|
|
|
|
disable: true
|
2022-06-14 16:12:58 +08:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: deploy
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
settings:
|
2023-07-09 02:26:34 +08:00
|
|
|
host:
|
|
|
|
from_secret: host
|
2022-06-14 16:12:58 +08:00
|
|
|
username: root
|
|
|
|
key:
|
|
|
|
from_secret: ssh_key
|
|
|
|
port: 22
|
|
|
|
script_stop: true
|
|
|
|
script:
|
2023-07-09 02:26:34 +08:00
|
|
|
- cd /var/www/todo
|
|
|
|
- git fetch
|
|
|
|
- git reset --hard ${DRONE_COMMIT}
|
2023-07-09 02:37:05 +08:00
|
|
|
- git checkout ${DRONE_BRANCH}
|
2023-07-09 02:26:34 +08:00
|
|
|
- docker-compose down
|
|
|
|
- docker-compose up -d --build
|
|
|
|
- docker image prune -f
|
|
|
|
when:
|
|
|
|
event:
|
|
|
|
include:
|
|
|
|
- push
|
|
|
|
- custom
|
2022-06-14 16:12:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
|