I haven’t seen many posts about Continuous Integration. Perhaps this is because Umbraco Cloud option offers this feature off the shelf but I have some customers that require customizations (custom databases) that would be costly on the Umbraco Cloud setup. Therefore I decided to spin up Jenkins that connects to Github repo and does automatic deployment from the main branch whenever there is push to it.
Here are few quick steps that gets you started.
1. Setup Github
Wheater you use Github or Gitlab or your own Git repo these steps do not matter. You just need a branching stradegy where the master branch matches what is in your live site.
Merge feature branches into the master branch using pull requests.
Install Jenkins
I have root server Windows 2019 running on Hetzner but I hear OVHCloud is good as well. So, I installed Jenkins instances directly on my test server and live server. I could do the setup with PowerShell remote but Jenkins is quick to install and requires very little maintainance and resources so I just have them running isolated on the given server.
In the Jenkins server you also need Microsoft Build Tools and Nuget installed on globally available.
Configure Jenkins for Umbraco
You need some plugins in order to build .NET projects and Frontend projects. Try these:
- MBBuild
- Global Slack Notifier Plugin (for notifying build success/failures)
- NodeJS Plugin (control npm builds)
- Nuget Plugin
- PowerShell plugin (for scripting)
- ThinBackup (for moving Jenkins configs between instances
Here is my sample configuration on Freestyle Jenkins project.
Node version
Nuget restore command and Injection to Assembly
Run MSBuild
Copy files from Jenkins build folder to Webroot
Post Build actions
That’s it. Minimail Jenkins setup for Umbraco projects that I use. This same setup works for any .NET projects as I did not include any actions on uSync or anything other Umbraco specific.
I have done few DevOps Setups on Jenkins, TeamCity, Azure Devops and Github Actions. Which ever CI/CD tool you are using I recommend to create your scriptinigs on Node and/or PowerShell so you can easily jump between as they all work essentially same way.