31 lines
699 B
Rust
31 lines
699 B
Rust
|
use crate::cmd::*;
|
||
|
use anyhow::Result;
|
||
|
use git2::Repository;
|
||
|
use url::Url;
|
||
|
|
||
|
pub(crate) async fn run(env: DroneEnv) -> Result<()> {
|
||
|
if env.branch != "master" {
|
||
|
return Ok(());
|
||
|
}
|
||
|
|
||
|
let common: Common = env.clone().into();
|
||
|
let repo = Repository::open(".")?;
|
||
|
let mut u = Url::parse(&env.push_url)?;
|
||
|
u.set_username(&env.auth_user).unwrap();
|
||
|
u.set_password(Some(&env.token)).unwrap();
|
||
|
repo.remote_delete("origin")?;
|
||
|
repo.remote("origin", u.as_str())?;
|
||
|
|
||
|
release::run(
|
||
|
common,
|
||
|
env.changelog_path,
|
||
|
None,
|
||
|
ReleaseMeta {
|
||
|
name: None,
|
||
|
draft: false,
|
||
|
pre_release: false,
|
||
|
},
|
||
|
)
|
||
|
.await
|
||
|
}
|