|
|
@@ -283,13 +283,9 @@ class VueAutoDeployer:
|
|
|
else:
|
|
|
logger.info(" 📄 %s", item)
|
|
|
|
|
|
-<<<<<<< Updated upstream
|
|
|
print("✓ 本地目录验证通过")
|
|
|
|
|
|
|
|
|
-=======
|
|
|
- logger.info("本地目录验证通过")
|
|
|
->>>>>>> Stashed changes
|
|
|
|
|
|
def _create_zip_from_source(self) -> str:
|
|
|
"""
|
|
|
@@ -654,14 +650,10 @@ class VueAutoDeployer:
|
|
|
return False
|
|
|
|
|
|
# 步骤1: 本地压缩文件
|
|
|
-<<<<<<< Updated upstream
|
|
|
step_num = "1/5" if self.frontend_project_dir else "1/4"
|
|
|
print(f"\n[步骤 {step_num}] 本地压缩Vue构建文件")
|
|
|
print("-"*40)
|
|
|
-=======
|
|
|
- logger.info("[步骤 1/4] 本地压缩Vue构建文件")
|
|
|
- logger.info("-" * 40)
|
|
|
->>>>>>> Stashed changes
|
|
|
+
|
|
|
temp_zip_path = self._create_zip_from_source()
|
|
|
temp_dir = os.path.dirname(temp_zip_path)
|
|
|
|
|
|
@@ -670,14 +662,10 @@ class VueAutoDeployer:
|
|
|
self._validate_all_local_directories()
|
|
|
|
|
|
# 步骤2: 连接到服务器
|
|
|
-<<<<<<< Updated upstream
|
|
|
step_num = "2/5" if self.frontend_project_dir else "2/4"
|
|
|
print(f"\n[步骤 {step_num}] 连接到远程服务器")
|
|
|
print("-"*40)
|
|
|
-=======
|
|
|
- logger.info("[步骤 2/4] 连接到远程服务器")
|
|
|
- logger.info("-" * 40)
|
|
|
->>>>>>> Stashed changes
|
|
|
+
|
|
|
if not self.connect():
|
|
|
return False
|
|
|
|
|
|
@@ -686,28 +674,19 @@ class VueAutoDeployer:
|
|
|
return False
|
|
|
|
|
|
# 步骤3: 上传文件
|
|
|
-<<<<<<< Updated upstream
|
|
|
step_num = "3/5" if self.frontend_project_dir else "3/4"
|
|
|
print(f"\n[步骤 {step_num}] 上传文件到服务器")
|
|
|
print("-"*40)
|
|
|
-=======
|
|
|
- logger.info("[步骤 3/4] 上传文件到服务器")
|
|
|
- logger.info("-" * 40)
|
|
|
->>>>>>> Stashed changes
|
|
|
+
|
|
|
remote_zip_path = os.path.join(self.remote_deploy_dir, self.zip_filename)
|
|
|
|
|
|
if not self.upload_file(temp_zip_path, remote_zip_path):
|
|
|
return False
|
|
|
|
|
|
# 步骤4: 执行部署脚本
|
|
|
-<<<<<<< Updated upstream
|
|
|
step_num = "4/5" if self.frontend_project_dir else "4/4"
|
|
|
print(f"\n[步骤 {step_num}] 执行远程部署脚本")
|
|
|
- print("-"*40)
|
|
|
-=======
|
|
|
- logger.info("[步骤 4/4] 执行远程部署脚本")
|
|
|
- logger.info("-" * 40)
|
|
|
->>>>>>> Stashed changes
|
|
|
+
|
|
|
|
|
|
# 构建部署命令,传递上传的zip文件路径作为参数 {remote_zip_path}
|
|
|
deploy_command = f"{self.remote_script_path}"
|
|
|
@@ -731,13 +710,9 @@ class VueAutoDeployer:
|
|
|
logger.info("部署成功完成")
|
|
|
|
|
|
# 可选: 验证部署结果
|
|
|
-<<<<<<< Updated upstream
|
|
|
print("\n验证部署结果...")
|
|
|
self.execute_command("ls -la /home/lq/nginx/html/ 2>/dev/null | head -10", verbose=True)
|
|
|
-=======
|
|
|
- logger.info("验证部署结果...")
|
|
|
- self.execute_command("ls -la /usr/share/nginx/html/ 2>/dev/null | head -10", verbose=True)
|
|
|
->>>>>>> Stashed changes
|
|
|
+
|
|
|
|
|
|
return True
|
|
|
|
|
|
@@ -811,7 +786,6 @@ def main():
|
|
|
logger.info("🚀 Vue前端应用自动化部署工具")
|
|
|
logger.info("=" * 70)
|
|
|
|
|
|
-<<<<<<< Updated upstream
|
|
|
print(f"服务器: {args.host}:{args.port}")
|
|
|
print(f"用户: {args.user}")
|
|
|
print(f"本地源目录: {args.source}")
|
|
|
@@ -821,14 +795,7 @@ def main():
|
|
|
print(f"远程目录: {args.remote_dir}")
|
|
|
print(f"部署脚本: {args.script}")
|
|
|
print("="*70)
|
|
|
-=======
|
|
|
- logger.info("服务器: %s:%s", args.host, args.port)
|
|
|
- logger.info("用户: %s", args.user)
|
|
|
- logger.info("本地源目录: %s", args.source)
|
|
|
- logger.info("远程目录: %s", args.remote_dir)
|
|
|
- logger.info("部署脚本: %s", args.script)
|
|
|
- logger.info("=" * 70)
|
|
|
->>>>>>> Stashed changes
|
|
|
+
|
|
|
|
|
|
try:
|
|
|
# 创建部署器实例
|