Skip to content

The only downloader you need. 下载器的集大成者。

ci: 发版只重新发布版本号变了的 Pack,去掉 jsDelivr 缓存清理

XiaoYouChRba294866f2e7
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 812f8524..92c393a7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -894,7 +894,7 @@ jobs:
run: uv python install 3.13
- name: Build pack zips
- run: uv run --no-project python3 scripts/build_pack.py --all
+ run: uv run --no-project python3 scripts/build_pack.py --bumped
- name: Generate versions.json
env:
@@ -959,12 +959,6 @@ jobs:
git pull --rebase
git push
- - name: Purge jsDelivr cache
- run: |
- for f in versions.json dist/packs/*.zip; do
- curl -s "https://purge.jsdelivr.net/gh/XiaoYouChR/Ghost-Downloader-3@main/${f}" || true
- done
-
- name: Push to CNB
continue-on-error: true
env:
diff --git a/CONTEXT.md b/CONTEXT.md
index 4e5edc6f..a3a23e0b 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -289,6 +289,10 @@ _Avoid_: source of truth 单独当术语;不叫 primary / 主镜像
客户端竞速拉取更新元数据和资产的一个托管端点。当前集合是 github 与 gitcode。
_Avoid_: Mirror、CDN、channel
+**Publish**:
+把一个 Pack 的新版本放到 Origin,客户端从此能收到它。只在 Pack 版本号变化时发生,与 App 的发版无关。
+_Avoid_: 发版、打包、release(指 App)
+
### GitHub 加速
**Proxy Site**:
diff --git a/scripts/build_pack.py b/scripts/build_pack.py
index 3486c463..d22d46b9 100644
--- a/scripts/build_pack.py
+++ b/scripts/build_pack.py
@@ -3,7 +3,7 @@
Usage:
python scripts/build_pack.py http_pack [bili_pack ...]
- python scripts/build_pack.py --all
+ python scripts/build_pack.py --bumped
"""
import argparse
import hashlib
@@ -57,30 +57,31 @@ def readManifest(packId: str) -> dict:
return tomllib.load(f).get("pack", {})
-def allPackIds() -> list[str]:
+def bumpedPackIds(packs: dict) -> list[str]:
return [
d.name for d in sorted(FEATURES_DIR.iterdir())
if d.is_dir() and d.name not in EXCLUDED_PACKS and (d / "manifest.toml").is_file()
+ and readManifest(d.name).get("version", "") != packs.get(d.name, {}).get("version")
]
def main():
parser = argparse.ArgumentParser(description="Build pack zips and update versions.json")
parser.add_argument("packs", nargs="*", help="Pack IDs to build")
- parser.add_argument("--all", action="store_true", help="Build all packs")
+ parser.add_argument("--bumped", action="store_true", help="Build packs whose version differs from versions.json")
args = parser.parse_args()
- if args.all:
- packIds = allPackIds()
+ versions = json.loads(VERSIONS_FILE.read_text()) if VERSIONS_FILE.is_file() else {"app": {}, "packs": {}}
+ packs = versions.setdefault("packs", {})
+
+ if args.bumped:
+ packIds = bumpedPackIds(packs)
elif args.packs:
packIds = args.packs
else:
- parser.error("Specify pack IDs or --all")
+ parser.error("Specify pack IDs or --bumped")
return
- versions = json.loads(VERSIONS_FILE.read_text()) if VERSIONS_FILE.is_file() else {"app": {}, "packs": {}}
- packs = versions.setdefault("packs", {})
-
for packId in packIds:
print(f"Building {packId}...")
zipPath = buildPackZip(packId)