feat: dSYM 按上传配置一并保存到远端,本地清理后回退到远端地址下载
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
c17b7d5ad9
commit
1466e24c83
@@ -192,6 +192,12 @@ def _write_download_page(config: dict, html: Path, manifest_url: str):
|
||||
)
|
||||
|
||||
|
||||
def _dsym_remote_path(config: dict) -> str:
|
||||
stem = _artifact_stem(config)
|
||||
folder = config.get("OSS_FLODER", "ios-builds").strip("/") or "ios-builds"
|
||||
return posixpath.join(folder, "iOS", f"{stem}.dSYM.zip")
|
||||
|
||||
|
||||
def _remote_paths(config: dict) -> tuple[str, str, str, str]:
|
||||
stem = _artifact_stem(config)
|
||||
folder = config.get("OSS_FLODER", "ios-builds").strip("/") or "ios-builds"
|
||||
@@ -295,6 +301,20 @@ def delete_published_artifacts(
|
||||
deleter(upload_config, remote_paths)
|
||||
|
||||
|
||||
def delete_published_dsym(build_config: dict, upload_config: dict):
|
||||
"""删除任务对应的远端 dSYM 压缩包。
|
||||
|
||||
dSYM 的远端对象键完全由构建配置(APPID/版本/分支/构建类型)决定,
|
||||
无需像 IPA 那样从已保存的下载链接反推,直接按命名规则删除即可。
|
||||
"""
|
||||
mode = upload_config.get("mode", "")
|
||||
if mode not in {"oss", "webdav"}:
|
||||
raise DistributionError("请选择 OSS 或 WebDAV 上传方式")
|
||||
|
||||
deleter = _delete_oss if mode == "oss" else _delete_webdav
|
||||
deleter(upload_config, [_dsym_remote_path(build_config)])
|
||||
|
||||
|
||||
def get_published_download_url(build_config: dict, upload_config: dict, published_url: str) -> str:
|
||||
"""返回用于受控下载的短时链接;WebDAV 保持原公开链接。"""
|
||||
if upload_config.get("mode") != "oss":
|
||||
@@ -409,3 +429,22 @@ def publish_ipa(config: dict, ipa_path: Path, build_dir: Path) -> tuple[str, str
|
||||
qrcode.make(urls[".html"]).save(qr_path)
|
||||
urls.update(uploader(upload, [(qr_path, qr_remote)]))
|
||||
return urls[".html"], urls[".png"]
|
||||
|
||||
|
||||
def publish_dsym(config: dict, dsym_path: Path, build_dir: Path) -> str:
|
||||
"""压缩并上传主 target 的 dSYM,返回下载 URL。"""
|
||||
upload = config.get("_upload_config", {})
|
||||
mode = upload.get("mode", "")
|
||||
if mode not in {"oss", "webdav"}:
|
||||
raise DistributionError("请选择 OSS 或 WebDAV 上传方式")
|
||||
|
||||
output_dir = build_dir / "distribution"
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
zip_base = output_dir / f"{_artifact_stem(config)}.dSYM"
|
||||
zip_path = Path(shutil.make_archive(
|
||||
str(zip_base), "zip", root_dir=str(dsym_path.parent), base_dir=dsym_path.name,
|
||||
))
|
||||
|
||||
uploader = _upload_oss if mode == "oss" else _upload_webdav
|
||||
urls = uploader(upload, [(zip_path, _dsym_remote_path(config))])
|
||||
return urls[".zip"]
|
||||
|
||||
Reference in New Issue
Block a user