vdev/commands/release/
push.rs1use anyhow::Result;
2use clap::Args;
3
4use crate::app;
5use crate::git;
6use itertools::Itertools;
7
8#[derive(Args, Debug)]
10#[command()]
11pub struct Cli {}
12
13impl Cli {
14 pub fn exec(self) -> Result<()> {
15 let version = app::version()?;
16 let version_minor = version.split('.').take(2).join(".");
17
18 let current_branch = git::current_branch()?;
19 let branch_name = format!("v{version_minor}");
20 let tag_name = format!("v{version}");
21 println!("Preparing the branch and the tag...");
22 git::checkout_or_create_branch(&branch_name)?;
23 git::merge_branch(¤t_branch)?;
24 git::tag_version(&tag_name)?;
25
26 println!("Pushing the branch and the tag...");
27 git::push_branch(&branch_name)?;
28 git::push_branch(&tag_name)?;
29
30 Ok(())
31 }
32}