GitHub Actions in Action: Continuous integration and delivery for DevOps cover
welcome to this free extract from
an online version of the Manning book.
to read more
or

4 GitHub Actions

 

This chapter covers

  • The types of GitHub actions
  • Authoring actions
  • Providing a hands-on lab: My first docker container action
  • Sharing actions
  • Developing advanced actions

Now that we have explored the YAML and workflow syntax in detail, this chapter will dive into the core building block of GitHub Actions—the reusable and sharable actions themselves that give the product its name.

This chapter will cover the different types of actions and offer some tips to get started writing your first actions. We will cover this in detail in a hands-on lab, which you can follow along step by step. Additionally, the chapter will cover sharing actions in the marketplace and internally as well as some advanced topics for action authors.

4.1 Types of actions

There are three different types of actions:

  • Docker container actions
  • JavaScript actions
  • Composite actions

Docker container actions only run on Linux whereas JavaScript and composite actions can be used on any platforms.

All actions are defined by a file, action.yml (or action.yaml), which contains the metadata for the action. This file cannot be named differently, meaning an action must reside in its own repository or folder. The run section in the action.yml file defines what type of action it is.

4.1.1 Docker container actions

4.1.2 JavaScript actions

4.1.3 Composite actions

4.2 Authoring actions

4.2.1 Getting started

4.2.2 Storing actions in GitHub

4.2.3 Compatibility with GitHub Enterprise Server

4.2.4 Release management

4.3 Hands-on lab: My first Docker container action

4.3.1 Using the template to create a new repository

4.3.2 Creating the Dockerfile for the action

4.3.3 Creating the action.yml file

4.3.4 Creating the entrypoint.sh script

4.3.5 Create a workflow to test the container

4.4 Sharing actions