Get started Bring yourself up to speed with our introductory content.

GitHub Actions tutorial walks through a CI/CD setup

There are many players in the CI/CD market, including GitHub Actions, a newcomer that holds a lot of promise.

The prospect of performing CI/CD with GitHub Actions entices developers, because almost every developer has at least some code on GitHub. Now with native CI/CD functionality, GitHub Actions users can build and deploy code at any frequency they prefer.

In this GitHub Actions tutorial, we walk through the setup of your first automated workflow, pushing code through HashiCorp Terraform and into Azure. The process starts with creating a repository, then cloning it to GitHub actions to create the workflow.

GitHub Actions supports a full range of CI/CD workflows for public and private repositories. The product also enables CI/CD for any OS or language across all cloud providers. This native support across all platforms comes into play when users set up a GitHub Actions workflow, which can run on a VM or in a container. GitHub-hosted agents facilitate these workflows, which means you don't have to worry about the build server where the code runs. GitHub handles all maintenance and scaling.

Set up a GitHub Actions workflow

In this tutorial, we take a brief detour into Microsoft Visual Studio Code, where we create two Terraform configuration files: main.tf and variables.tf. These configurations represent a resource group and allow GitHub to authenticate and interact with Microsoft Azure, the cloud choice for this tutorial.

GitHub suggests several common connections to other tools and providers for the GitHub Actions workflow automation. When you create a new Action, you can select a premade workflow or set up a custom workflow -- we opt for the latter in this GitHub Actions tutorial. The premade GitHub Actions workflows support platforms like Azure, Google Kubernetes Engine and AWS, as well as specific programming languages like Rust, Python and Ruby.

When you create a GitHub Actions workflow, you can run it every time you push to a repository. In our tutorial, the workflow file defines the Terraform steps, which include:

  • checkout from master
  • initialization
  • plan
  • apply

Then, commit the file. We must also format and commit the Terraform code, then stage the environment. Once GitHub completes the action, you will see the resource group in Azure or whatever hosting destination you've chosen.

GitHub Actions is free for public repositories, and charges private repository users based on the amount of monthly minutes and storage used. Users can run GitHub Actions on their own hardware or on a cloud platform.

View All Videos
Cloud Computing
App Architecture
ITOperations
TheServerSide.com
SearchAWS
Close