From 153d0a8142d14c6c0d71eb0ba98d3e09c7e7abea Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 14 Aug 2024 22:29:23 -0400 Subject: [PATCH] Add a update/update_comfyui_stable.bat to the standalones. --- .ci/update_windows/update.py | 29 ++++++++++++++++++++ .ci/update_windows/update_comfyui_stable.bat | 8 ++++++ 2 files changed, 37 insertions(+) create mode 100755 .ci/update_windows/update_comfyui_stable.bat diff --git a/.ci/update_windows/update.py b/.ci/update_windows/update.py index cc79a914..6a04e5e1 100755 --- a/.ci/update_windows/update.py +++ b/.ci/update_windows/update.py @@ -75,6 +75,25 @@ else: print("pulling latest changes") pull(repo) +if "--stable" in sys.argv: + def latest_tag(repo): + versions = [] + for k in repo.references: + try: + prefix = "refs/tags/v" + if k.startswith(prefix): + version = list(map(int, k[len(prefix):].split("."))) + versions.append((version[0] * 10000000000 + version[1] * 100000 + version[2], k)) + except: + pass + versions.sort() + if len(versions) > 0: + return versions[-1][1] + return None + latest_tag = latest_tag(repo) + if latest_tag is not None: + repo.checkout(latest_tag) + print("Done!") self_update = True @@ -115,3 +134,13 @@ if not os.path.exists(req_path) or not files_equal(repo_req_path, req_path): shutil.copy(repo_req_path, req_path) except: pass + + +stable_update_script = os.path.join(repo_path, ".ci/update_windows/update_comfyui_stable.bat") +stable_update_script_to = os.path.join(cur_path, "update_comfyui_stable.bat") + +try: + if not file_size(stable_update_script_to) > 10: + shutil.copy(stable_update_script, stable_update_script_to) +except: + pass diff --git a/.ci/update_windows/update_comfyui_stable.bat b/.ci/update_windows/update_comfyui_stable.bat new file mode 100755 index 00000000..e18010da --- /dev/null +++ b/.ci/update_windows/update_comfyui_stable.bat @@ -0,0 +1,8 @@ +@echo off +..\python_embeded\python.exe .\update.py ..\ComfyUI\ --stable +if exist update_new.py ( + move /y update_new.py update.py + echo Running updater again since it got updated. + ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --stable +) +if "%~1"=="" pause