nuke: Trigger subsequent targets
I have 2 targets:
UpdateVersion - target that update version in AssemblyInfo.cs
CreateReleaseBranch - target that create release branch (I’m lazy to do it manually 😄)
I want after execute target CreateReleaseBranch execute UpdateVersion as well. So I can’t add DependsOn(CreateReleaseBranch) for UpdateVersion target because I can call UpdateVersion sometimes and do not want to execute CreateReleaseBranch.
I understand that I can use -Skip to not execute CreateReleaseBranch when I do run UpdateVersion but this is ugly workaround because I can forget about this.
The only way I can manage right now is to create additional target CreateReleaseBranchAndUpdateVersion which has right dependencies and use Before(UpdateVersion) on CreateReleaseBranch. But I want something like this:
Target CreateReleaseBranch => _ => _
.Executes(() =>
{
// Some staff
UpdateVersion.Invoke();
// or
Execute(UpdateVersion);
}
Because it doesn’t make any sense to create release branch without updating version in develop branch.
Is it possible to do it?
If you can point me somewhere in source, I’ll create a PR for this feature.
I think it can be useful in some cases.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (10 by maintainers)
ContinueOnFailureandAssuredAfterFailurehave been added in prerelease. You still need triggers or dependencies to make them execute.^Cis not planned in the near future, but you’re welcome to create an issue for that.This is not intentionally either. You should use
BeforeandAfterto declare ordering dependencies.@ljani the example used in my comment here is not a good one, as it suggests that this works like
IDisposable. However, it doesn’t, and that was not the intent.For your case to work, you would need to set a flag in the middle part, similar to this:
Although I’m not sure how we can visualize this in
--graph.