Building a Skeleton CI/CD Pipeline with Blazor, GitHub Actions, and Azure
In this tutorial, you will learn how to create a CI/CD pipeline that will build, test, containerise and deploy a Blazor application to Azure App Service using GitHub Actions and Docker.
Overview
So, I didn't realise 'The CI/CD Skeleton' was a commonly used term until someone had pointed it out on one of my LinkedIn posts, but it is and so I thought it only right to reference it by name.
The concept is straightforward: before commencing any project, the primary focus is on establishing a robust framework for continuous integration and continuous delivery. Initiating this process at the project's inception ensures a consistent flow of work into production (or production-like) environments.
This approach minimises the risk of installation and upgrade issues during deployment, thanks to the continuous and incremental nature of the process.
Moreover, integrating thorough testing and code analysis into the continuous integration pipeline enhances the overall reliability of the system. Ensuring that code passes all automated tests and code quality gates before they can be deployed to production.
Now you might be asking, 'why can't I do this later on?', and to that I say 'you can't, because I'm watching you'...
Well you can, if you really want to have difficult deployments and spend your Saturday's fixing an issue you've spent the past three days trying to rollback. Don't be lazy, the longer you put this off, the more difficult it will become to implement later down the line, and the more urgent it will be too.
To prevent this article from becoming excessively lengthy, I'll assume you're already familiar with the advantages of containerisation and CI/CD. If not, please let me know, and I'll happily write a separate article on the topic, I promise.
Now, I will be showing you how to create a Skeleton CI/CD Pipeline that uses the following technologies:
Blazor
bUnit/xUnit
Docker
GitHub Actions
Azure App Service
And will be creating doing the following pipelines:
Build (Continuous Integration)
1. Build dotnet application
2. Run tests on application
3. Build docker imageDeploy (Continuous Deployment)
1. Pushes docker image version to Github Container Registry
2. Pushes latest sha version to Azure App Service, which the Web App will now reference when running.
To follow along this tutorial, you will need:
.Net 8.0
Visual Studio (Or JetBrains Rider)
GitHub
Docker
Azure - Get 12 months free here
Keep reading with a 7-day free trial
Subscribe to Tech Unfiltered to keep reading this post and get 7 days of free access to the full post archives.