Cake is really useful for building and packaging .net solutions(both net framework/core). In the world of Sitecore where Helix is the first design choice, Cake can be used to build and package the Sitecore solutions.
Habitat sample has cake scripts that can be used to build Sitecore solutions if they follow Helix principles however, Habita sample uses PowerShell scripts for Sitecore Commerce. While working on a Sitecore Commerce project, I decided to write Cake build, here is a list of Tasks I created. You can access the code repository here: https://github.com/isyedakhtar/SitecoreCommerce
- Default Task For Local Builds: This task is only for developer’s local machines. It does the following
- Clean Solution
- Build Solution
- Run Sonarq analysis(optional)
- Publish Commerce Engine Project
- Copy Published Commerce Engine Project to all Roles
- Transform Policies – I am using JDT transformation for policies.
- Replace Variables with actual values in transformed policies
- Bootstrap
- Quick-Deploy For Local Builds: This task is also for developer’s local machines. It does everything same as Default except running bootstrap.
- Build-Nuget For Building and Packaging: This task is used mainly on build agents like Teamcity etc where we build the solution and create nuget package. Later on, this package is used by deployment tools like Octopus to run the deployment. It does the following
- Clean Solution
- Build Solution
- Run Sonarq analysis(optional)
- Publish Commerce Engine Project
- Transform Policies
- Create a Nuget Package