@@ -149,12 +149,45 @@ def download_cache_artifacts():
149149 files = [f .name for f in dest .iterdir ()]
150150 print (f" { platform } : { files } " )
151151
152+
153+ def trigger_and_wait_cache_build ():
154+ """Trigger a new build-cache CI run and wait for it to complete."""
155+ import time
156+ print ("Triggering build-cache CI run..." )
157+ r = subprocess .run (
158+ ["gh" , "workflow" , "run" , "build-cache.yml" , "--repo" , repo ],
159+ capture_output = True , text = True
160+ )
161+ if r .returncode != 0 :
162+ print (f" WARNING: Could not trigger build-cache: { r .stderr .strip ()} " )
163+ return
164+ time .sleep (8 )
165+ r2 = subprocess .run (
166+ ["gh" , "run" , "list" , "--repo" , repo , "--workflow" , "build-cache.yml" ,
167+ "--limit" , "1" , "--json" , "databaseId" ],
168+ capture_output = True , text = True
169+ )
170+ run_id = json .loads (r2 .stdout )[0 ]["databaseId" ]
171+ print (f" Waiting for run { run_id } ..." )
172+ while True :
173+ r3 = subprocess .run (
174+ ["gh" , "run" , "view" , str (run_id ), "--repo" , repo , "--json" , "status,conclusion" ],
175+ capture_output = True , text = True
176+ )
177+ data = json .loads (r3 .stdout )
178+ if data ["status" ] == "completed" :
179+ print (f" Done: { data ['conclusion' ]} " )
180+ return
181+ print (f" { data ['status' ]} ... waiting 15s" )
182+ time .sleep (15 )
183+
152184def main ():
153185 version = sys .argv [1 ] if len (sys .argv ) > 1 else None
154186 if version :
155187 bump_version_files (version )
188+ trigger_and_wait_cache_build ()
156189 download_cache_artifacts ()
157- zip_name = f"CppMode- { version } .zip" if version else "CppMode.zip"
190+ zip_name = "CppMode.zip"
158191 zip_path = os .path .join (OUTPUT_DIR , zip_name )
159192
160193 if os .path .exists (zip_path ):
0 commit comments