@@ -81,16 +81,33 @@ def bump_version_files(tag):
8181
8282def download_cache_artifacts ():
8383 """Download precompiled .o files from latest successful build-cache CI run."""
84- import subprocess , shutil
84+ import subprocess , json
85+ from pathlib import Path
8586 repo = "processing-cpp/processing.cpp"
8687 root = Path (__file__ ).parent .parent
8788 platforms = ["linux-x64" , "windows-x64" , "macos-arm64" , "macos-x64" ]
8889 print ("Downloading precompiled cache from CI artifacts..." )
90+
91+ # Find the latest successful build-cache run
92+ r = subprocess .run (
93+ ["gh" , "run" , "list" , "--repo" , repo , "--workflow" , "build-cache.yml" ,
94+ "--status" , "success" , "--limit" , "1" , "--json" , "databaseId" ],
95+ capture_output = True , text = True
96+ )
97+ if r .returncode != 0 or not r .stdout .strip ():
98+ print (" WARNING: Could not find successful build-cache run" )
99+ return
100+ run_id = json .loads (r .stdout )[0 ]["databaseId" ]
101+ print (f" Using run { run_id } " )
102+
89103 for platform in platforms :
90104 dest = root / "cache" / platform
105+ # Clear existing files so gh run download can overwrite
106+ import shutil
107+ if dest .exists (): shutil .rmtree (dest )
91108 dest .mkdir (parents = True , exist_ok = True )
92109 result = subprocess .run (
93- ["gh" , "run" , "download" , "--repo" , repo ,
110+ ["gh" , "run" , "download" , str ( run_id ), "--repo" , repo ,
94111 "--name" , f"cache-{ platform } " , "--dir" , str (dest )],
95112 capture_output = True , text = True
96113 )
0 commit comments