๐ง๐ Project discontinued
Problem I want to solve
Every time I want to release a new version in my C# projects, I have to do it manually or define a custom GH action for every repo. I would like to have a general solution that makes this automatically every time I merge a PR. Also, as I have been playing with NUKE lately, I want to include it in the solution.
info
NUKE is a build automation framework where you define operations as build, test or push NuGets, in a C# project. I found good reviews and some videos in Channel9 about it. So, for instance, dotnet commands are predefined methods, and its arguments are extension methods, check the next example:
How a NUKE project looks like?
Target Pack => _ => _
.DependsOn(Clean)
.Executes(() =>
{
DotNetTasks
.DotNetPack(s => s
.SetProject(project.Path)
.SetOutputDirectory(outputFolderAbsolutePath)
.SetConfiguration(configuration)
.SetVersionPrefix(currentPackageVersion)
.SetVersionSuffix(versionSuffix)
.EnableNoRestore());
});
Goals
- Build a solution that releases a new version every time a PR is merged.
- The Solution should be based on NUKE.
- Any repository should be able to use it.
Approach
cangulo.nuke.releasecreator will execute the following operations sequentially:
- Calculate the next version based on the commits merged
- Release a new version through the GH API client (provided by NUKE).
Next are the requirements for calculating the release number:
- The repository app follows Semantic Versioning.
- All PR contain Conventional Commits which set the release to be created (major, minor or fix).
So, if an app has the version 0.0.2
and a PR with a fix commit as fix: solved error in the controller
is merged, the version released will be 0.0.3
.
Remarks
- I'm not saying NUKE is the best solution, I just want to give it a try ๐. In the future, I will create another solution based on scripts.
- As I started coding this, I realize that I can define more tasks as:
- To update the version in
.csproj
files. I did this as optional. - To update the changelog using cangulo.changelog
- To push custom Assets to the release, like a JSON schema that we updated
- To update the version in
How to use it?
Please check the examples given here.
Where do I use it?
I call this solution through a specific GH Action in the next projects:
- cangulo-nugets/cangulo.changelog
- cangulo-nugets/cangulo.common.testing
- cangulo-nuke/cangulo.nuke.prcommitsvalidations
- cangulo-actions/cangulo.nuke.prcommitsvalidations
- cangulo-tf/basic-iac
Repository
solution cangulo.nuke.releasecreator
GitHub Action
github action to execute in ANY repository
About me
I'm a Software Engineer with experience as Developer and DevOps. The technologies I have worked with are DotNet, Terraform and AWS. For the last one, I have the Developer Associate certification. I define myself as a challenge-seeker person and team player. I simply give it all to deliver high-quality solutions. On the other hand, I like to analyze and improve processes, promote productivity and document implementations (yes, I'm a developer that likes to document ๐งโ๐ป).
You can check my experience here.
Personal Blog - cangulo.github.io
GitHub - Carlos Angulo Mascarell - cangulo
LinkedIn - Carlos Angulo Mascarell
Twitter - @AnguloMascarell