use crate::config::read_spruce_config;
use xshell::{Shell, cmd};
pub fn push() -> Result<(), Box<dyn std::error::Error>> {
let sh = Shell::new()?;
let config = read_spruce_config()?;
let full_image_name = format!(
"{}/{}:{}",
config.namespace, config.project_name, config.version
);
let latest_image_name = format!("{}/{}:latest", config.namespace, config.project_name);
println!("Pushing image: {}", full_image_name);
cmd!(sh, "docker push {full_image_name}").run()?;
println!("[OK] Pushed {}", full_image_name);
cmd!(sh, "docker push {latest_image_name}").run()?;
println!("[OK] Pushed {}", latest_image_name);
println!("\nPush complete!");
Ok(())
}