From 1541a3fed1b9f9586355c0f47c155a5c09d157e8 Mon Sep 17 00:00:00 2001 From: stephensund Date: Wed, 13 May 2026 10:54:05 +0800 Subject: [PATCH 1/2] ci: use latest azlassets, clean up Chinese comments - Remove version pin: pip install azlassets (was ==4.0.0) - Replace Chinese section headers with concise English comments - Patches retained: VersionType.__hash__ (harmless) and remove_asset dir fix (still needed) --- .github/workflows/jp-loadingbg.yml | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/jp-loadingbg.yml b/.github/workflows/jp-loadingbg.yml index ebecbae..5748697 100644 --- a/.github/workflows/jp-loadingbg.yml +++ b/.github/workflows/jp-loadingbg.yml @@ -19,15 +19,13 @@ jobs: with: python-version: "3.11" - - name: Install azlassets (v4.x) + - name: Install azlassets run: | python -m pip install --upgrade pip - pip install "azlassets==4.0.0" + pip install azlassets azl --help - # ============================= - # 恢复 azlassets state cache(非常小) - # ============================= + # Restore azlassets state cache from previous release - name: Restore azlassets state cache (if exists) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -87,9 +85,7 @@ jobs: azl.main() PY - # ============================= - # 恢复上次 loadingbg_full.zip → last_loadingbg(用于 diff) - # ============================= + # Restore previous full snapshot for diff comparison - name: Restore last loadingbg snapshot (if exists) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -107,16 +103,12 @@ jobs: fi fi - # ============================= - # 收集本次 loadingbg(若没更新可能不存在) - # ============================= + # Collect current JP loadingbg files - name: Collect loadingbg run: | python scripts/collect_loadingbg.py - # ============================= - # diff + zip(你已修过:无 current_loadingbg 也能正常结束) - # ============================= + # Diff current vs previous, generate zip archives - name: Diff and zip run: | bash scripts/diff_and_zip.sh @@ -132,9 +124,7 @@ jobs: echo "generated_at=$(date -u)" >> meta.txt echo "has_diff=${{ steps.diffcheck.outputs.has_diff }}" >> meta.txt - # ============================= - # 打包 state cache(只保留逻辑状态,不含 AssetBundles) - # ============================= + # Pack azlassets logical state (excluding AssetBundles) for next run - name: Pack azlassets client state run: | rm -rf state_tmp @@ -146,9 +136,7 @@ jobs: fi tar -cf jp-client-state.tar -C state_tmp ClientAssets - # ============================= - # 发布 Release - # ============================= + # Publish GitHub Release with all artifacts - name: Publish Release uses: softprops/action-gh-release@v2 with: From c7c651e236472fa58c9c97fe6b2ecd13647ffc60 Mon Sep 17 00:00:00 2001 From: stephensund Date: Wed, 13 May 2026 10:59:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20patch=20=E5=85=BC=E5=AE=B9=20azlasse?= =?UTF-8?q?ts=20v4.1.0=20(remove=5Fasset=20=E2=86=92=20delete=5Fasset=5Fsa?= =?UTF-8?q?fe)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch 2 现在同时兼容: - 旧版本: remove_asset - 新版本: delete_asset_safe --- .github/workflows/jp-loadingbg.yml | 48 +++++++++++++++++++----------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/.github/workflows/jp-loadingbg.yml b/.github/workflows/jp-loadingbg.yml index 5748697..5bc8b43 100644 --- a/.github/workflows/jp-loadingbg.yml +++ b/.github/workflows/jp-loadingbg.yml @@ -61,24 +61,38 @@ jobs: else: print("[patch] VersionType.__hash__ already present:", VT.__hash__) - # Patch 2: remove_asset 支持目录删除(修复 IsADirectoryError) - _orig_remove_asset = updater.remove_asset - def _patched_remove_asset(assetpath): - import pathlib - # azlassets 版本差异:assetpath 可能为 AssetPath 对象(带 .full) - # 或已经是 pathlib.Path - if isinstance(assetpath, pathlib.Path): - p = assetpath - else: - p = pathlib.Path(assetpath.full) - if p.is_dir(): - import shutil - shutil.rmtree(p) - print(f"[patch] Removed directory: {p}") + # Patch 2: delete_asset_safe / remove_asset 支持目录删除(修复 IsADirectoryError) + import pathlib + if hasattr(updater, 'remove_asset'): + _orig_func = updater.remove_asset + _func_name = 'remove_asset' + elif hasattr(updater, 'delete_asset_safe'): + _orig_func = updater.delete_asset_safe + _func_name = 'delete_asset_safe' + else: + _orig_func = None + _func_name = None + + if _orig_func is not None: + def _patched_func(assetpath): + if isinstance(assetpath, pathlib.Path): + p = assetpath + else: + p = pathlib.Path(assetpath.full) + if p.is_dir(): + import shutil + shutil.rmtree(p) + print(f"[patch] Removed directory: {p}") + else: + _orig_func(assetpath) + + if _func_name == 'remove_asset': + updater.remove_asset = _patched_func else: - _orig_remove_asset(assetpath) - updater.remove_asset = _patched_remove_asset - print("[patch] Patched updater.remove_asset to handle directories") + updater.delete_asset_safe = _patched_func + print(f"[patch] Patched updater.{_func_name} to handle directories") + else: + print("[patch] No remove_asset or delete_asset_safe found, skipping directory patch") # 让 azl 按 CLI 方式运行 download JP sys.argv = ["azl", "download", "JP"]