current_branch

Function current_branch 

Source
pub fn current_branch() -> Result<String>
Examples found in repository?
examples/ci.rs (line 29)
12fn try_main() -> Result<()> {
13    let cargo_toml = cargo_toml()?;
14
15    {
16        let _s = section("BUILD");
17        cmd!("cargo test --workspace --no-run").run()?;
18    }
19
20    {
21        let _s = section("TEST");
22        cmd!("cargo test --workspace --no-run").run()?;
23    }
24
25    let version = cargo_toml.version()?;
26    let tag = format!("v{}", version);
27    let dry_run = env::var("CI").is_err()
28        || git::tag_list()?.contains(&tag)
29        || git::current_branch()? != "master";
30    xaction::set_dry_run(dry_run);
31
32    {
33        let _s = section("PUBLISH");
34        cargo_toml.publish()?;
35        git::tag(&tag)?;
36        git::push_tags()?;
37    }
38    Ok(())
39}