How to use GitHub Actions
The platform GitHub Actions allows users to automate various actions by providing continuous integration and continuous delivery. With GitHub Actions, you don’t have to complete repetitive tasks manually anymore, allowing you to fully concentrate on the more important aspects of your project.
What is GitHub Actions?¶
GitHub Actions is the continuous integration and continuous delivery (CI/CD) platform of GitHub. It allows users to automate repositories and create GitHub workflows. For example, you can compile new code or run project-related unit tests every time code is updated in the GitHub repository.
How does GitHub Actions work?¶
GitHub Actions leverages your own GitHub workflows. Within these workflows, you can react to various events, such as push requests, by executing specific actions. The workflow itself consists of different jobs, each running in its own virtual machine or within a container. GitHub supports Linux, Windows, and macOS VMs.
If you want to deploy your projects and websites directly, Deploy Now from IONOS is the ideal solution. You can use it to customise your automated GitHub workflows anytime.
GitHub Actions tutorial on the most important functions¶
A GitHub workflow is the central element within GitHub Actions. A workflow is really nothing more than a YAML file that you use to specify which actions should be initiated when certain events occur. However, not just events can trigger workflows. You can also ensure that your workflow is executed manually, or even set up fixed times by using scheduling. Every GitHub workflow starts one or more jobs. You don’t have to limit yourself to one workflow per repository and can specify any number of workflows in your GitHub repository.
As mentioned, workflows are often triggered by events. Events are specific actions in your GitHub repository that start the execution of a workflow. A pull request is a common example of a GitHub event. There are countless events in GitHub. For a complete list, take a look at the GitHub documentation.
As the name suggest, actions are a central part of GitHub Actions. An action is an individual GitHub application that carries out frequent and complex tasks. They can be used like functions within your workflow files to avoid repeating code. If you don’t want to write your own GitHub actions, you can find a number of predefined actions in the GitHub marketplace.
Steps are individual job components. They can be shell scripts that are executed or an action that is started. Steps are processed in the order in which they are defined. Furthermore, the steps are dependent on each other and can exchange data within each other.
A job is a sequence of steps that are executed on a runner. Although jobs are independent, you can create dependencies between individual jobs manually. This results in a job having to wait for all the jobs it depends on to execute first. This interrupts the otherwise normal, parallel execution of different jobs.
A runner is the server on which your triggered workflows are run. Each runner can run exactly one job at a time. The runners are basically virtual machines. GitHub supports Ubuntu, Windows and macOS operating systems. If you need to use a different operating system to test your projects, you can, of course, host your own runners.
What are the advantages of using GitHub Actions?¶
In addition to the seamless integration of GitHub Actions into your own GitHub platform, the CI service offers other benefits as well. For example, predefined templates mean you don’t necessarily have to use your own workflows. Plus, the GitHub service is completely free to use for your public repositories. For private repos, GitHub provides you with 2,000 minutes per month for hosted workflows.