No Widgets found in the Sidebar

It is important to have code in source control. It allows you to collaborate and has a central location where the code can live. But what if you want information on whether the code builds (or compiles as expected)? Source control won’t tell and you don’t want to manually build the code each time a new commit is pushed. It’s not only cumbersome but also it’s not scalable. What is the solution?
This blog post will show you how to use GitHub Actions to build C# code directly from GitHub. GitHub Actions is a free CICD tool that allows you to create and deploy code directly from a GitHub repository.
Prerequisites for GitHub actions
One of the best things about GitHub Actions, is that it’s fully integrated into GitHub. This means there are no additional steps to install or configure it.
You will need the following to follow along with this blog post:
Learn how to become a security expert with SPOTO’s Cybersecurity Training
Get started training.
An introduction to GitHub Actions
Basic knowledge of C# or understanding how to read code in other languages.
You can sign up here for a free GitHub account.

Step 1: Take a look at the Repository and fork it
You must have code to build before you can start a CI process. It doesn’t need to be specific. It can be a frontend or backend application. This blog post will use a C# boilerplate for web API, which can be found here on GitHub.
The C# web API boilerplate can’t be customized in any way. This means that you don’t need to worry about any key customizations.
Open a web browser to access the Blazor API on GitHub.

Click the Fork button on the GitHub page to fork the repository to a GitHub Account that you are logged into.

After the code has been forked to a GitHub account you are using, you can now see the Blazor repository.
First Look at the Code
Click on the Blazor repository and click on the web directory to open the Program.cs C# File to view the code.
This code will display the default Program for building a C# Blazor application, including all the required namespaces.
0123456789101112131415161718192021222324252627using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Threading.Tasks;using Microsoft.AspNetCore;using Microsoft.AspNetCore.Hosting;using Microsoft.Extensions.Configuration;using Microsoft.Extensions.Hosting;using Microsoft.Extensions.Logging;namespace blazorSolution public class Program public static void Main(string[] args) CreateHostBuilder(args).Build().Run(); public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup(); ); Step 2: How to Build Workflows in GitHub Actions
Now that you have a good understanding of the code, it is time to build the workflow in GitHub actions.
Click on the Actions button within the repository.

You will see a variety of workflows when you click the Actions button. Workflows are the code you create to build the CI or CICD pipeline. All pipelines can be configured as code to allow for reuse and collaboration between teams.

GitHub Actions will suggest pre-made workflows based upon the type of code in the repository. GitHub will suggest a few C# workflows because it knows that the repository contains C# codes. Click the Set up this workflow link on the.NET Core workflow.

The workflow will be automatically created and presented to your. Let’s take a look at each section.
The default name for the workflow is.NET

By Delilah