use anyhow::Context;
use clap::{Parser, Subcommand};
use holochain_release_util::{prepare_release, publish_release};
use std::path::PathBuf;
#[derive(Parser)]
#[command(version, about, long_about = None)]
pub struct ReleaseUtilCli {
#[arg(long, default_value = ".")]
dir: PathBuf,
#[command(subcommand)]
command: ReleaseUtilCommand,
}
#[derive(Subcommand)]
pub enum ReleaseUtilCommand {
Prepare {
#[arg(long)]
cliff_config: String,
#[arg(long)]
force_version: Option<String>,
#[arg(long)]
i_am_so_sorry_but_my_features_clash: bool,
},
Publish,
}
fn main() -> anyhow::Result<()> {
println!("Starting release-util...");
let cli = ReleaseUtilCli::parse();
match cli.command {
ReleaseUtilCommand::Prepare {
cliff_config,
force_version,
i_am_so_sorry_but_my_features_clash,
} => {
prepare_release(
cli.dir,
cliff_config,
force_version,
i_am_so_sorry_but_my_features_clash,
)?;
}
ReleaseUtilCommand::Publish => {
let token = std::env::var("GH_TOKEN").context("Missing GH_TOKEN env var")?;
publish_release(cli.dir, token, false, false)?;
}
}
Ok(())
}