@smbcloud / cli / commits / a35b645

update deployment to done when it's done

Seto Elkahfi committed Jun 2, 2025 at 20:02 UTC a35b645653d1e4972e2e875d21c8d0ea13e143c1
1 file changed +23 -5
crates/cli/src/deploy/mod.rs
+23 -5
@@ -153,11 +153,29 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
153 );
154
155 match origin.push(&["refs/heads/main:refs/heads/main"], Some(&mut push_opts)) {
156 - Ok(_) => Ok(CommandResult {
157 - spinner,
158 - symbol: succeed_symbol(),
159 - msg: succeed_message("Deployment complete."),
160 - }),
156 + Ok(_) => {
157 + // Update deployment status to Done
158 + let update_payload = DeploymentPayload {
159 + commit_hash: commit_hash.to_string(),
160 + status: DeploymentStatus::Done,
161 + };
162 + let result = update(
163 + env,
164 + access_token.clone(),
165 + config.project.id.clone(),
166 + created_deployment.id.clone(),
167 + update_payload,
168 + ).await;
169 + match result {
170 + Ok(_) => println!("Deployment status successfully updated to Done."),
171 + Err(update_err) => eprintln!("Error updating deployment status to Done: {}", update_err),
172 + }
173 + Ok(CommandResult {
174 + spinner,
175 + symbol: succeed_symbol(),
176 + msg: succeed_message("Deployment complete."),
177 + })
178 + },
179 Err(e) => Err(anyhow!(fail_message(&e.to_string()))),
180 }
181 }