chore: add logging to stdout
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
84cc24e81c
commit
f75e839759
@ -40,6 +40,7 @@ See docs for more information about installation and some such
|
|||||||
|
|
||||||
- [ ] Add docs
|
- [ ] Add docs
|
||||||
- [ ] Add asciinema
|
- [ ] Add asciinema
|
||||||
|
- [ ] Create docker image
|
||||||
- [ ] Add examples
|
- [ ] Add examples
|
||||||
- [ ] Fx drone config
|
- [ ] Fx drone config
|
||||||
- [ ] Releaser
|
- [ ] Releaser
|
||||||
@ -55,5 +56,4 @@ See docs for more information about installation and some such
|
|||||||
### 0.x Milestone
|
### 0.x Milestone
|
||||||
- [ ] Add github support
|
- [ ] Add github support
|
||||||
- [ ] Add custom strategies
|
- [ ] Add custom strategies
|
||||||
- [ ] Create docker image
|
|
||||||
- [ ] Add more granular tests
|
- [ ] Add more granular tests
|
||||||
|
@ -37,15 +37,26 @@ impl ReleaseCommandHandler {
|
|||||||
let branch = self.config.get_branch();
|
let branch = self.config.get_branch();
|
||||||
let source = self.config.get_source();
|
let source = self.config.get_source();
|
||||||
|
|
||||||
|
self.ui.write_str_ln("running releaser");
|
||||||
|
|
||||||
self.check_git_remote_connection(owner, repository)?;
|
self.check_git_remote_connection(owner, repository)?;
|
||||||
|
tracing::trace!("connected to git remote");
|
||||||
|
|
||||||
let significant_tag = self.get_most_significant_tag(owner, repository)?;
|
let significant_tag = self.get_most_significant_tag(owner, repository)?;
|
||||||
|
tracing::trace!("found lastest release tag");
|
||||||
|
|
||||||
let commits =
|
let commits =
|
||||||
self.fetch_commits_since_last_tag(owner, repository, &significant_tag, branch)?;
|
self.fetch_commits_since_last_tag(owner, repository, &significant_tag, branch)?;
|
||||||
|
tracing::trace!("fetched commits since last version");
|
||||||
let current_version = get_current_version(significant_tag);
|
let current_version = get_current_version(significant_tag);
|
||||||
|
tracing::trace!("found current version: {}", current_version.to_string());
|
||||||
|
self.ui.write_str_ln(&format!(
|
||||||
|
"found current version: {}",
|
||||||
|
current_version.to_string()
|
||||||
|
));
|
||||||
|
|
||||||
let conventional_commit_results = parse_conventional_commits(current_version, commits)?;
|
let conventional_commit_results = parse_conventional_commits(current_version, commits)?;
|
||||||
|
tracing::trace!("parsing conventional commits");
|
||||||
if conventional_commit_results.is_none() {
|
if conventional_commit_results.is_none() {
|
||||||
tracing::debug!("found no new commits, aborting early");
|
tracing::debug!("found no new commits, aborting early");
|
||||||
self.ui
|
self.ui
|
||||||
@ -53,12 +64,19 @@ impl ReleaseCommandHandler {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let (commit_strs, next_version) = conventional_commit_results.unwrap();
|
let (commit_strs, next_version) = conventional_commit_results.unwrap();
|
||||||
|
self.ui.write_str_ln(&format!(
|
||||||
|
"calculated next version: {}",
|
||||||
|
next_version.to_string()
|
||||||
|
));
|
||||||
|
|
||||||
|
tracing::trace!("creating changelog");
|
||||||
let (changelog_placement, changelog, changelog_last_changes) =
|
let (changelog_placement, changelog, changelog_last_changes) =
|
||||||
compose_changelog(&commit_strs, &next_version, source)?;
|
compose_changelog(&commit_strs, &next_version, source)?;
|
||||||
|
|
||||||
if let Some(first_commit) = commit_strs.first() {
|
if let Some(first_commit) = commit_strs.first() {
|
||||||
if first_commit.contains("chore(release): ") {
|
if first_commit.contains("chore(release): ") {
|
||||||
|
tracing::trace!("creating release");
|
||||||
|
self.ui.write_str_ln("creating release");
|
||||||
self.create_release(
|
self.create_release(
|
||||||
dry_run,
|
dry_run,
|
||||||
owner,
|
owner,
|
||||||
@ -71,6 +89,7 @@ impl ReleaseCommandHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tracing::trace!("creating pull-request");
|
||||||
self.create_pull_request(
|
self.create_pull_request(
|
||||||
changelog_placement,
|
changelog_placement,
|
||||||
changelog,
|
changelog,
|
||||||
@ -117,12 +136,17 @@ impl ReleaseCommandHandler {
|
|||||||
changelog_last_changes: Option<String>,
|
changelog_last_changes: Option<String>,
|
||||||
branch: &str,
|
branch: &str,
|
||||||
) -> Result<(), anyhow::Error> {
|
) -> Result<(), anyhow::Error> {
|
||||||
|
self.ui
|
||||||
|
.write_str_ln("creating and checking out release branch");
|
||||||
self.git_client.checkout_branch()?;
|
self.git_client.checkout_branch()?;
|
||||||
std::fs::write(changelog_placement, changelog.as_bytes())?;
|
std::fs::write(changelog_placement, changelog.as_bytes())?;
|
||||||
|
self.ui.write_str_ln("committed changelog files");
|
||||||
self.git_client
|
self.git_client
|
||||||
.commit_and_push(next_version.to_string(), dry_run)?;
|
.commit_and_push(next_version.to_string(), dry_run)?;
|
||||||
let _pr_number = match self.gitea_client.get_pull_request(owner, repository)? {
|
let _pr_number = match self.gitea_client.get_pull_request(owner, repository)? {
|
||||||
Some(existing_pr) => {
|
Some(existing_pr) => {
|
||||||
|
self.ui.write_str_ln("found existing pull request");
|
||||||
|
self.ui.write_str_ln("updating pull request");
|
||||||
if !dry_run {
|
if !dry_run {
|
||||||
self.gitea_client.update_pull_request(
|
self.gitea_client.update_pull_request(
|
||||||
owner,
|
owner,
|
||||||
@ -137,6 +161,7 @@ impl ReleaseCommandHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
self.ui.write_str_ln("creating pull request");
|
||||||
if !dry_run {
|
if !dry_run {
|
||||||
self.gitea_client.create_pull_request(
|
self.gitea_client.create_pull_request(
|
||||||
owner,
|
owner,
|
||||||
|
Loading…
Reference in New Issue
Block a user