This commit is contained in:
parent
12fb2130e9
commit
c73482e827
|
|
@ -294,10 +294,15 @@ class Deployer:
|
||||||
commit_msg = self.config['deploy']['commit_message'].format(
|
commit_msg = self.config['deploy']['commit_message'].format(
|
||||||
repo_name=repo_config['name']
|
repo_name=repo_config['name']
|
||||||
)
|
)
|
||||||
|
|
||||||
if not self.run_command(f'git commit -m "{commit_msg}"', cwd=repo_path):
|
if not self.run_command(f'git commit -m "{commit_msg}"', cwd=repo_path):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# 推送前先拉取远程最新代码
|
||||||
|
self.logger.info("推送前先拉取远程最新代码...")
|
||||||
|
if not self.run_command(f"git pull --rebase origin {self.main_repo_branch}", cwd=repo_path):
|
||||||
|
self.logger.warning("拉取远程代码失败,尝试直接推送")
|
||||||
|
|
||||||
# 推送到远程
|
# 推送到远程
|
||||||
if not self.run_command(f"git push origin {self.main_repo_branch}", cwd=repo_path):
|
if not self.run_command(f"git push origin {self.main_repo_branch}", cwd=repo_path):
|
||||||
self.logger.warning("推送失败,但部署已完成")
|
self.logger.warning("推送失败,但部署已完成")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue