Skip to content

Commit b589dca

Browse files
committed
fix: 在git checkout前清理文件避免冲突
- 将rm -rf web/dist web/node_modules移到git fetch之前 - 确保git checkout不会因为本地文件冲突而失败 - 修复CI/CD部署流程
1 parent befa40b commit b589dca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/deploy.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ jobs:
7474
envs: APP_DOMAIN,DB_PASSWORD,JWT_SECRET,REDIS_PASSWORD
7575
script: |
7676
cd /opt/TinyFlow
77-
# 拉取最新代码(关键:确保本地更改被丢弃)
77+
78+
# 清理前端构建产物和依赖(避免 git checkout 冲突)
79+
rm -rf web/dist web/node_modules
80+
81+
# 拉取最新代码
7882
git fetch origin
7983
git checkout origin/$(git symbolic-ref --short HEAD)
8084
@@ -84,9 +88,6 @@ jobs:
8488
sudo sed -i "s|Environment=\"JWT_SECRET=.*\"|Environment=\"JWT_SECRET=$JWT_SECRET\"|g" /etc/systemd/system/tinyflow.service
8589
sudo sed -i "s|Environment=\"REDIS_PASSWORD=.*\"|Environment=\"REDIS_PASSWORD=$REDIS_PASSWORD\"|g" /etc/systemd/system/tinyflow.service
8690
87-
# 清理前端构建产物和依赖(避免 git checkout 冲突)
88-
rm -rf web/dist web/node_modules
89-
9091
# 重新构建前端
9192
cd web
9293
npm ci --prefer-offline --no-audit

0 commit comments

Comments
 (0)