todo/.drone.yml

162 lines
2.5 KiB
YAML

# drone 会自动先拉取代码
# 再按顺序执行 pipeline 配置中定义的任务
kind: pipeline
type: docker
name: feature
platform:
os: linux
arch: amd64
trigger:
branch:
include:
- feature/*
clone:
disable: true
steps:
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: host
username: root
key:
from_secret: ssh_key
port: 22
script_stop: true
script:
- cd /var/www/todo
- git fetch
- git checkout ${DRONE_BRANCH}
- git reset --hard ${DRONE_COMMIT}
- docker-compose down
- docker-compose up -d --build --force-recreate
- docker image prune -f
when:
event:
include:
- push
- custom
---
kind: pipeline
type: docker
name: develop
platform:
os: linux
arch: amd64
trigger:
branch:
include:
- develop
clone:
disable: true
steps:
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: host
username: root
key:
from_secret: ssh_key
port: 22
script_stop: true
script:
- cd /var/www/todo
- git fetch
- git checkout ${DRONE_BRANCH}
- git reset --hard ${DRONE_COMMIT}
- docker-compose down
- docker-compose up -d --build --force-recreate
- docker image prune -f
when:
event:
include:
- push
---
kind: pipeline
type: docker
name: main-pull-request-staging
platform:
os: linux
arch: amd64
trigger:
branch:
include:
- main
clone:
disable: true
steps:
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: host
username: root
key:
from_secret: ssh_key
port: 22
script_stop: true
script:
- cd /var/www/todo
- git fetch
- git checkout ${DRONE_BRANCH}
- git reset --hard ${DRONE_COMMIT}
- docker-compose down
- docker-compose up -d --build --force-recreate
- docker image prune -f
when:
event:
- pull_request
action:
include:
- opened
- reopened
- synchronized
---
kind: pipeline
type: docker
name: main-merge-pull-request-prod
platform:
os: linux
arch: amd64
trigger:
branch:
include:
- main
event:
include:
- push
clone:
disable: true
steps:
- name: semantic-release
image: gtramontina/semantic-release:17.4.3
environment:
GITHUB_TOKEN:
from_secret: gitea_token
entrypoint:
- semantic-release