Skip to content
use crate::commands::build::build;
use crate::commands::push::push;
use xshell::Shell;
use xshell::cmd;

pub fn release() -> Result<(), Box<dyn std::error::Error>> {
    let sh = Shell::new()?;

    println!("\nStep 1/4: Building Docker image...");
    build()?;

    println!("\nStep 2/4: Committing version update...");
    cmd!(sh, "git add -A").run()?;
    cmd!(sh, "git commit -m 'chore: update version'").run()?;
    println!("[OK] Committed with message: chore: update version");

    println!("\nStep 3/4: Pushing to git remote...");
    cmd!(sh, "git push").run()?;
    println!("[OK] Pushed to git remote");

    println!("\nStep 4/4: Pushing Docker image...");
    push()?;

    println!("\nRelease complete!");

    Ok(())
}