Intro to GitHub Actions

Premier Developer

Premier

In this post, Sr. App Dev Manager Jason Giordano shows us how to use GitHub Actions to create a very simple CI/CD solution.


GitHub actions makes it easy to automate all your software workflows. You can join through the link provide here: https://github.com/features/actions. The general availability date was November 13, 2019. To get ready for GitHub Actions, I have created a very simple application to demonstrate the basics. When you are ready to expand your solution, refer to the documentation here: https://help.github.com/en/github/automating-your-workflow-with-github-actions/about-github-actions

Prerequisites for this walkthrough:

DotNet Core (2.2): https://dotnet.microsoft.com/download/dotnet-core

Git: https://git-scm.com/downloads

GitHub Desktop: https://desktop.github.com/

To get started:

Open a Command Prompt and enter:

dotnet new console -o "Blog"

cd Blog
dotnet run

git init
git add .
git commit -m "Init"

For the last step (git push), we will use the GUI to showcase another option for working with Git repositories, especially for those who prefer a user interface.

Open GitHub Desktop (sign in to GitHub.com) and click “Add an Existing Repository from your hard drive…”

Click “Choose…” and navigate to the “Blog” folder and click “Select Folder” then “Add repository”

Click “Publish repository”

Click “Publish repository”

Click the “View on GitHub” button

Click the “Set up Actions” button

Click the “Set up this workflow” button

Click the “Start commit” button then the “Commit new file” button

Click the “Actions” tab

Click “.NET Core” to see the automated build

Click the “Code” tab

Click “Program.cs”

Click the “Edit this file” icon

Change the text to:

String sDayOfWeek = DateTime.Now.ToString("dddd");
Console.WriteLine("Happy " + sDayOfWeek + "!");

Click the “Commit changes” button at the bottom

Click the “Actions” tab to view the automated build process

This was a very simple intro to GitHub Actions, as well as some of the other tools you may use in the future. Now you are ready to apply these basic concepts to your development process and research the complex workflows available.

0 comments

Leave a comment