Skip to main content

cangulo.nuke.releasecreator

ยท 3 min read
Carlos Angulo Mascarell
๐Ÿšง๐Ÿ›‘ 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:

  1. Calculate the next version based on the commits merged
  2. Release a new version through the GH API client (provided by NUKE).

Next are the requirements for calculating the release number:

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

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:

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

Did you like it? Share It!


Comments