Files
test/.drone.yml
moweishan 2378bc21d7
Some checks failed
continuous-integration/drone/push Build encountered an error
更新 .drone.yml
2025-12-29 15:46:23 +00:00

48 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
kind: pipeline
type: docker
name: main-automated-pipeline
# 合并所有触发规则:满足任一条件即可触发流水线
trigger:
event:
- push # 代码推送到main分支时自动触发
- promote # 晋升环境时触发CI平台操作
- manual # 手动点击触发CI平台操作
branch:
- main # 限定仅main分支生效
target:
- production # 晋升/手动触发时限定目标环境为production
# 步骤1自动运行逻辑仅 push 事件执行)
steps:
- name: print-auto-run
image: alpine:latest
# 条件判断:只有触发事件是 push 时,才执行此步骤
when:
event: push
commands:
- echo "====================================="
- echo "这是自动运行的流水线"
- echo "触发事件: ${DRONE_BUILD_EVENT}"
- echo "触发分支: ${DRONE_BRANCH}"
- echo "提交者: ${DRONE_COMMIT_AUTHOR}"
- echo "提交消息: ${DRONE_COMMIT_MESSAGE}"
- echo "自动运行"
- echo "====================================="
# 步骤2手动/晋升运行逻辑(仅 promote/manual 事件执行)
- name: print-manual-trigger
image: alpine:latest
# 条件判断:只有触发事件是 promote/manual 时,才执行此步骤
when:
event:
- promote
- manual
commands:
- echo "====================================="
- echo "这是手动触发的流水线"
- echo "触发事件: ${DRONE_BUILD_EVENT}"
- echo "触发目标: ${DRONE_DEPLOY_TO}"
- echo "当前时间: $(date)"
- echo "手动触发"
- echo "====================================="