Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,12 @@ relative to the base of the repo; other paths are relative to that root
arbitrary labels to you projects, which is useful when using the
`info` command.
- `hooks`: (optional) A set of hooks that run at certain points of the
release process. Currently, only the `post_write` hook is supported:
this hook runs after local file changes are made, but before any VCS
release process. Currently, there are only two hooks:
- `post_write` this hook runs after local file changes are made, but before any VCS
commits/push/tagging is performed; it's useful to make additional
file changes that need to be committed with the release.
- `on_finish` this hooks runs after everything has been pushed to remote repo and right before
the program exits. This could be used to trigger pipelines for specific project.

- `commit`

Expand Down
8 changes: 8 additions & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,14 @@ pub async fn release(
}

output.commit();

for (project_id, (size, _)) in plan.incrs() {
if size != &Size::Fail && size > &Size::None {
let proj = mono.get_project(project_id)?;
let hook = proj.hooks();
hook.execute_on_finish(&proj.root())?;
}
}
Ok(())
}

Expand Down
7 changes: 6 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,8 @@ impl HookSet {
}

pub fn execute_post_write(&self, root: &Option<&String>) -> Result<()> { self.execute("post_write", root) }

pub fn execute_on_finish(&self, root: &Option<&String>) -> Result<()> { self.execute("on_finish", root) }
}

impl<'de> Deserialize<'de> for HookSet {
Expand Down Expand Up @@ -1218,7 +1220,9 @@ impl Ord for Size {
}

fn default_includes() -> Vec<String> { vec!["**/*".into()] }

fn default_prev_tag() -> String { "versio-prev".into() }

fn default_branch() -> Option<String> { None }

fn deser_labels<'de, D: Deserializer<'de>>(desr: D) -> std::result::Result<Vec<String>, D::Error> {
Expand Down Expand Up @@ -1314,9 +1318,10 @@ fn match_opts() -> MatchOptions { MatchOptions { require_literal_separator: true

#[cfg(test)]
mod test {
use super::{ConfigFile, FileLocation, HashMap, Location, Picker, Project, ProjectId, ScanningPicker, Size};
use crate::scan::parts::Part;

use super::{ConfigFile, FileLocation, HashMap, Location, Picker, Project, ProjectId, ScanningPicker, Size};

#[test]
fn test_both_file_and_tags() {
let data = r#"
Expand Down