The continuous integration and continuous delivery platform GitHub Actions allows you to automate different actions. By eliminating the need to manually perform repetitive tasks, you can spend more time on your real projects.
GitHub Actions: what is it?¶
GitHub Actions is the platform developed by GitHub for continuous integration and delivery. It allows users toautomate their repositoriesbut also to create “GitHub workflows”. In particular, it is possible to compile new code or run unit tests related to a project, all by default, as soon as the code is updated in the corresponding GitHub repository.
How does GitHub Actions work?
GitHub Actions builds directly on your GitHub workflows. In these workflows, you can adapt to different events that occur, such as « push » requests, and trigger the appropriate actions to react to them. A workflow consists of different tasks (or » Jobs ), each of them running in its own virtual machine or within a container. GitHub supports Linux, Windows, and macOS virtual machines.
To directly deploy your projects and websites, the Deploy Now solution offered by IONOS is ideal. It allows you to customize your GitHub workflows at any time.
GitHub Actions: Essentials¶
Workflows¶
A GitHub workflow is thecentral element of any use of GitHub Actions. With this workflow, which is really nothing more than a YAML file, you can define actions to be executed when certain events occur. To trigger a workflow, you don’t necessarily need an event: you can just as well run your workflow manuallyor use theplanning tool to provide for its regular execution, on a fixed date. Each GitHub workflow therefore allows you toperform one or more tasks. You don’t have to limit yourself to one workflow per repository; in fact, you are free to define any number of workflows for your GitHub repository.
Events¶
As we have just explained, workflows are often triggered by « events » : it means thata specific action within your GitHub repository triggers the execution of a workflow. Pull requests are a classic example of GitHub events. However, it is possible to use many other events. The complete list of these solutions is available in the GitHub documentation.
Shares¶
Actions are of course the central point of the GitHub Actions tool, to which they even gave their name. A « share » means a individual GitHub application who performs complex tasks among those that come up most often. Feel free to use them in your workflow files, like functions, to avoid duplicating your code. If you don’t want to have to write your GitHub Actions yourself, be aware that a whole range of predefined actions are available on GitHub Marketplace.
Steps¶
The steps correspond to elements individuals who together constitute tasks. They take on the strength of shell scripts, which should be executed, or actions which you simply need to launch. The different steps are processed in the order in which you defined them. In addition, they rely on each other and can exchange data between them.
Tasks¶
A task is simply a succession of steps followed by an « executor ». Tasks are normally independent, but be aware that it is possible to manually create dependencies between your different tasks; the tasks concerned must then « wait » for all the other tasks on which they depend, which is likely to interrupt the normal execution of different tasks in parallel.
Executor¶
The executor is the server on which your workflows run. An executor can support only one task at a time. Basically, therefore, executors are virtual machines. Linux Ubuntu, Windows, and macOS operating systems are supported by GitHub. If you need another operating system to test your projects on, you can choose to host your executors yourself.
Benefits of GitHub Actions¶
GitHub Actions integrates seamlessly with your work with GitHub, and its continuous integration service also provides many other benefits. You can opt for predefined templates, without necessarily having to use your own workflows. Also, this GitHub service is totally free for public repositories. As for private repositories, GitHub offers 2,000 minutes per month for hosted workflows.