Book Image

Mastering GitHub Actions

By : Eric Chapman
Book Image

Mastering GitHub Actions

By: Eric Chapman

Overview of this book

Navigating GitHub Actions often leaves developers grappling with inefficiencies and collaboration bottlenecks. Mastering GitHub Actions offers solutions to these challenges, ensuring smoother software development. With 16 extensive chapters, this book simplifies GitHub Actions, walking you through its vast capabilities, from team and enterprise features to organization defaults, self-hosted runners, and monitoring tools. You’ll learn how to craft reusable workflows, design bespoke templates, publish actions, incorporate external services, and introduce enhanced security measures. Through hands-on examples, you’ll gain best-practice insights for team-based GitHub Actions workflows and discover strategies for maximizing organization accounts. Whether you’re a software engineer or a DevOps guru, by the end of this book, you'll be adept at amplifying productivity and leveraging automation's might to refine your development process.
Table of Contents (22 chapters)
Free Chapter
1
Part 1:Centralized Workflows to Assist with Governance
7
Part 2: Implementing Advanced Patterns within Actions
14
Part 3: Best Practices, Patterns, Tricks, and Tips Toolkit

Exploring workflow jobs

In this section, we’ll explore how you can use containers and services to run jobs in your GitHub Actions workflows. This powerful feature allows you to control the environment in which your jobs run and can be incredibly useful when your jobs have specific dependencies. But before we do this, let’s take a look at how jobs work.

Understanding how jobs work

In GitHub Actions, a workflow run is made up of one or more jobs. Jobs are defined in the workflow file and represent the tasks the workflow will perform. Each job runs in an environment specified by runs-on. Here’s a high-level look at how jobs work:

  • Run on a virtual host: Each job runs on a fresh instance of the virtual environment specified by runs-on. This could be GitHub-hosted runners, such as ubuntu-latest, windows-latest, and macos-latest, or self-hosted runners.
  • Run in parallel: By default, jobs run in parallel. If you need jobs to run sequentially, you can define...