fix: 修复 Drone CI/CD 配置
Some checks failed
continuous-integration/drone/push Build is failing

- 修正远程仓库名: origin -> cicd
- 修正前端目录: kaopeilian-frontend -> frontend
- 后端部署增加代码同步到容器挂载目录
This commit is contained in:
yuliang_guo
2026-01-29 18:11:58 +08:00
parent 37b8d6be1a
commit 6ddd8a5aae

View File

@@ -22,9 +22,9 @@ steps:
script:
- echo "=== [测试环境] 同步代码 ==="
- cd /root/aiedu
- git fetch origin
- git checkout test 2>/dev/null || git checkout -b test origin/test
- git reset --hard origin/test
- git fetch cicd
- git checkout test 2>/dev/null || git checkout -b test cicd/test
- git reset --hard cicd/test
- echo "代码同步完成"
- name: build-frontend-test
@@ -38,14 +38,14 @@ steps:
command_timeout: 10m
script:
- echo "=== [测试环境] 编译前端到 dist-test ==="
- cd /root/aiedu/kaopeilian-frontend
- cd /root/aiedu/frontend
- npm install --silent
- npm run build
- rm -rf /root/aiedu/dist-test/*
- cp -r dist/* /root/aiedu/dist-test/
- echo "前端编译完成 -> dist-test"
- name: restart-backend
- name: deploy-backend
image: appleboy/drone-ssh
settings:
host: 120.79.247.16
@@ -55,7 +55,8 @@ steps:
port: 22
command_timeout: 5m
script:
- echo "=== [测试环境] 重启后端 ==="
- echo "=== [测试环境] 部署后端 ==="
- cp -r /root/aiedu/backend/app/* /root/aiedu/kaopeilian-backend/app/
- docker restart kpl-backend-dev
- sleep 5
- docker ps | grep kpl-
@@ -86,9 +87,9 @@ steps:
script:
- echo "=== [预生产] 同步代码 ==="
- cd /root/aiedu
- git fetch origin
- git checkout staging 2>/dev/null || git checkout -b staging origin/staging
- git reset --hard origin/staging
- git fetch cicd
- git checkout staging 2>/dev/null || git checkout -b staging cicd/staging
- git reset --hard cicd/staging
- echo "代码同步完成"
- name: build-frontend-staging
@@ -102,14 +103,14 @@ steps:
command_timeout: 10m
script:
- echo "=== [预生产] 编译前端到 dist-staging ==="
- cd /root/aiedu/kaopeilian-frontend
- cd /root/aiedu/frontend
- npm install --silent
- npm run build
- rm -rf /root/aiedu/dist-staging/*
- cp -r dist/* /root/aiedu/dist-staging/
- echo "前端编译完成 -> dist-staging"
- name: restart-backend
- name: deploy-backend
image: appleboy/drone-ssh
settings:
host: 120.79.247.16
@@ -119,7 +120,8 @@ steps:
port: 22
command_timeout: 5m
script:
- echo "=== [预生产] 重启后端 ==="
- echo "=== [预生产] 部署后端 ==="
- cp -r /root/aiedu/backend/app/* /root/aiedu/kaopeilian-backend/app/
- docker restart kaopeilian-backend
- sleep 5
- docker ps | grep kaopeilian-
@@ -157,8 +159,8 @@ steps:
script:
- echo "=== [生产] 同步代码 ==="
- cd /root/aiedu
- git fetch origin
- git reset --hard origin/main
- git fetch cicd
- git reset --hard cicd/main
- echo "代码同步完成"
- name: build-frontend-prod
@@ -172,7 +174,7 @@ steps:
command_timeout: 10m
script:
- echo "=== [生产] 编译前端到 dist-prod ==="
- cd /root/aiedu/kaopeilian-frontend
- cd /root/aiedu/frontend
- npm install --silent
- npm run build
- rm -rf /root/aiedu/dist-prod/*