This commit is contained in:
2026-07-06 17:06:48 +08:00
parent 9293fe4e59
commit 2ef6762785

View File

@@ -327,10 +327,11 @@ steps:
- git pull origin release - git pull origin release
- docker login harbor.bluettipower.com -u bluetti -p cjJXBbkHlvVWH2B - docker login harbor.bluettipower.com -u bluetti -p cjJXBbkHlvVWH2B
- | - |
diff_failed=0
if [ "${DRONE_COMMIT_BEFORE}" = "0000000000000000000000000000000000000000" ]; then if [ "${DRONE_COMMIT_BEFORE}" = "0000000000000000000000000000000000000000" ]; then
changed_files=$(git diff-tree --no-commit-id --name-only -r ${DRONE_COMMIT_AFTER}) changed_files=$(git diff-tree --no-commit-id --name-only -r ${DRONE_COMMIT_AFTER}) || diff_failed=1
else else
changed_files=$(git diff --name-only ${DRONE_COMMIT_BEFORE} ${DRONE_COMMIT_AFTER}) changed_files=$(git diff --name-only ${DRONE_COMMIT_BEFORE} ${DRONE_COMMIT_AFTER}) || diff_failed=1
fi fi
export TARGET_SITES="shopify-australia shopify-x" export TARGET_SITES="shopify-australia shopify-x"
@@ -353,6 +354,10 @@ steps:
export BUILD_ENV="production" export BUILD_ENV="production"
export COMMIT_SHA=${DRONE_COMMIT:0:10} export COMMIT_SHA=${DRONE_COMMIT:0:10}
echo "本次变更文件:" echo "本次变更文件:"
if [ "$diff_failed" -eq 1 ]; then
echo "⚠️ 变更范围计算失败,回退为全量部署。"
changed_files="packages/__force_full_deploy__"
fi
echo "$changed_files" echo "$changed_files"
full_build_changes=$(echo "$changed_files" | grep -E "^(package\.json|pnpm-lock\.yaml|pnpm-workspace\.yaml|turbo\.json|docker-compose.*\.ya?ml|packages/|patches/)" | wc -l) full_build_changes=$(echo "$changed_files" | grep -E "^(package\.json|pnpm-lock\.yaml|pnpm-workspace\.yaml|turbo\.json|docker-compose.*\.ya?ml|packages/|patches/)" | wc -l)
@@ -518,13 +523,14 @@ steps:
script: script:
- echo ">>>>>> 开始连接远程服务器 <<<<<<" - echo ">>>>>> 开始连接远程服务器 <<<<<<"
- cd /bluetti/frontend_project/bluetti-shop - cd /bluetti/frontend_project/bluetti-shop
- git pull origin release - git pull origin main
- docker login harbor.bluettipower.com -u bluetti -p cjJXBbkHlvVWH2B - docker login harbor.bluettipower.com -u bluetti -p cjJXBbkHlvVWH2B
- | - |
diff_failed=0
if [ "${DRONE_COMMIT_BEFORE}" = "0000000000000000000000000000000000000000" ]; then if [ "${DRONE_COMMIT_BEFORE}" = "0000000000000000000000000000000000000000" ]; then
changed_files=$(git diff-tree --no-commit-id --name-only -r ${DRONE_COMMIT_AFTER}) changed_files=$(git diff-tree --no-commit-id --name-only -r ${DRONE_COMMIT_AFTER}) || diff_failed=1
else else
changed_files=$(git diff --name-only ${DRONE_COMMIT_BEFORE} ${DRONE_COMMIT_AFTER}) changed_files=$(git diff --name-only ${DRONE_COMMIT_BEFORE} ${DRONE_COMMIT_AFTER}) || diff_failed=1
fi fi
export TARGET_SITES="shopify-australia shopify-x" export TARGET_SITES="shopify-australia shopify-x"
@@ -534,6 +540,10 @@ steps:
export BUILD_ENV="production" export BUILD_ENV="production"
export COMMIT_SHA=${DRONE_COMMIT:0:10} export COMMIT_SHA=${DRONE_COMMIT:0:10}
echo "本次变更文件:" echo "本次变更文件:"
if [ "$diff_failed" -eq 1 ]; then
echo "⚠️ 变更范围计算失败,回退为全量部署。"
changed_files="packages/__force_full_deploy__"
fi
echo "$changed_files" echo "$changed_files"
full_build_changes=$(echo "$changed_files" | grep -E "^(package\.json|pnpm-lock\.yaml|pnpm-workspace\.yaml|turbo\.json|docker-compose.*\.ya?ml|packages/|patches/)" | wc -l) full_build_changes=$(echo "$changed_files" | grep -E "^(package\.json|pnpm-lock\.yaml|pnpm-workspace\.yaml|turbo\.json|docker-compose.*\.ya?ml|packages/|patches/)" | wc -l)
@@ -617,6 +627,17 @@ depends_on:
- RC-frontend-monorepo-ci - RC-frontend-monorepo-ci
- PROD-frontend-monorepo-ci - PROD-frontend-monorepo-ci
trigger:
event:
- push
- promote
- rollback
branch:
- dev
- test
- release
- main
steps: steps:
- name: send-dingtalk-notification - name: send-dingtalk-notification
image: lddsb/drone-dingtalk-message image: lddsb/drone-dingtalk-message
@@ -638,15 +659,6 @@ steps:
status: status:
- success - success
- failure - failure
event:
- push
- promote
- rollback
branch:
- dev
- test
- release
- main
volumes: volumes:
- name: dingtalk-tpl - name: dingtalk-tpl