修复:Node.js 项目在子模块目录执行构建命令

This commit is contained in:
孙小云 2026-01-09 18:47:56 +08:00
parent 05f0cf1dad
commit 589159c025
1 changed files with 12 additions and 2 deletions

View File

@ -155,10 +155,20 @@ class Deployer:
self.logger.info(f"开始构建: {repo_config['name']}") self.logger.info(f"开始构建: {repo_config['name']}")
# 执行构建命令(在主仓库根目录执行) # 根据项目类型选择执行目录
if repo_config['type'] == 'nodejs':
# Node.js 项目在子模块目录执行
build_dir = repo_path / repo_config['path']
self.logger.info(f"Node.js 项目,在子模块目录执行构建")
else:
# Java 项目在主仓库根目录执行
build_dir = repo_path
self.logger.info(f"Java 项目,在主仓库根目录执行构建")
# 执行构建命令
for cmd in repo_config['build_commands']: for cmd in repo_config['build_commands']:
self.logger.info(f"执行构建命令: {cmd}") self.logger.info(f"执行构建命令: {cmd}")
if not self.run_command(cmd, cwd=repo_path, timeout=1800): if not self.run_command(cmd, cwd=build_dir, timeout=1800):
self.logger.error(f"构建失败: {cmd}") self.logger.error(f"构建失败: {cmd}")
return False return False