更新 .drone.yml
Some checks failed
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2025-12-29 15:48:18 +00:00
parent 2378bc21d7
commit 8fd99be3bd

View File

@@ -1,23 +1,19 @@
---
kind: pipeline kind: pipeline
type: docker type: docker
name: main-automated-pipeline name: main-automated-pipeline
# 合并所有触发规则:满足任一条件即可触发流水线
trigger: trigger:
event: event:
- push # 代码推送到main分支时自动触发 - push
- promote # 晋升环境时触发CI平台操作 - promote
- manual # 手动点击触发CI平台操作 - manual
branch: branch:
- main # 限定仅main分支生效 - main
target: target:
- production # 晋升/手动触发时限定目标环境为production - production
# 步骤1自动运行逻辑仅 push 事件执行)
steps: steps:
- name: print-auto-run - name: print-auto-run
image: alpine:latest image: alpine:latest
# 条件判断:只有触发事件是 push 时,才执行此步骤
when: when:
event: push event: push
commands: commands:
@@ -29,11 +25,8 @@ steps:
- echo "提交消息: ${DRONE_COMMIT_MESSAGE}" - echo "提交消息: ${DRONE_COMMIT_MESSAGE}"
- echo "自动运行" - echo "自动运行"
- echo "=====================================" - echo "====================================="
# 步骤2手动/晋升运行逻辑(仅 promote/manual 事件执行)
- name: print-manual-trigger - name: print-manual-trigger
image: alpine:latest image: alpine:latest
# 条件判断:只有触发事件是 promote/manual 时,才执行此步骤
when: when:
event: event:
- promote - promote
@@ -45,4 +38,4 @@ steps:
- echo "触发目标: ${DRONE_DEPLOY_TO}" - echo "触发目标: ${DRONE_DEPLOY_TO}"
- echo "当前时间: $(date)" - echo "当前时间: $(date)"
- echo "手动触发" - echo "手动触发"
- echo "=====================================" - echo "====================================="