File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1011,9 +1011,30 @@ async fn build(
10111011 }
10121012 }
10131013
1014+ // --- Step 6: Purge the edge cache so clients see the new version ---
1015+ invalidate_build_cf ( & state, & org, & app) . await ;
1016+
10141017 Ok ( new_build_version)
10151018}
10161019
1020+ /// Invalidate the CloudFront cache for an application's `/build` routes.
1021+ async fn invalidate_build_cf ( state : & web:: Data < AppState > , org : & str , app : & str ) {
1022+ let path = format ! ( "/build/{}/{}*" , org, app) ;
1023+
1024+ if let Err ( e) = release:: utils:: invalidate_cf (
1025+ & state. cf_client ,
1026+ path,
1027+ & state. env . cloudfront_distribution_id ,
1028+ )
1029+ . await
1030+ {
1031+ info ! (
1032+ "Failed to invalidate CloudFront cache for build {}/{}: {:?}" ,
1033+ org, app, e
1034+ ) ;
1035+ }
1036+ }
1037+
10171038async fn extract_args (
10181039 path : web:: Path < ( String , String ) > ,
10191040 state : web:: Data < AppState > ,
You can’t perform that action at this time.
0 commit comments