Member-only story
Build GitHub Actions Using Docker Containers
Build and deploy a GitHub action to the GitHub marketplace

GitHub supports several third-party tools for continuous integration and continuous deployment tools, such as Travis CI and Circle CI. On the other hand, GitHub offers its own CI service, which is GitGub workflows.
Workflows can be created to achieve several goals, such as building docker images, running unit tests, and even deploying to a remote server. The workflows can be triggered based on GitHub events as well as external events. For instance, It is possible to create a workflow that will be executed once you create a new release on the repository. In addition, the same workflow can be configured to be triggered by an external API call.
The structure of the workflow consists of the usage of several GitHub actions to achieve the workflow goal. Actions are tasks that are needed to complete the CI workflow. For instance, the checkout action will checkout the GitHub repository on the runner machine. The full list of the GitHub actions can be viewed on the GitHub marketplace.
Actions are not only developed by GitHub; in fact, developing actions is open for the public, and many known companies and even individual developed their own actions and published them to the GitHub market place.
There are two types of actions that can be used and integrated with GitHub workflows:
- Docker container actions: This type allows you to package all the dependencies needed for your action in the docker image and they will be built on the runner machine before executing the action.
- JavaScript actions: These actions run directly on the runner machine and therefore they are much faster than the docker actions. The actions must be written in pure javascript without using any binaries.
In this post, I will explain the necessary steps for creating and publishing a docker GitHub action.
Building a docker GitHub action is pretty simple and easy. Below is the list of the files that need to be included in the action repository.
action.yml: This file is using YAML syntax, and is used to define the action metadata that describes the action. Below is a…