Examples of GitHub Actions
I find that the best way to learn is through examples. Developers that have any interest in mastering CI/CD on the world’s largest cloud-based offering are in luck.
Here are 10 GitHub Actions examples that they need to know.
List of GitHub Actions examples
The 10 best GitHub Action examples, presented in the proper viewing order, are:
- Get started with GitHub Actions workflows example
- GitHub Actions Docker exploration example
- How to create a multi-step GitHub workflow tutorial
- When to use GitHub Action jobs
- How to run workflows in Windows, MacOS and Linux
- Run a simple shell script as part of a CI/CD build
- View the GitHub Action environment variables example
- GitHub Actions build example with Java and Apache Maven
- Cache GitHub Action dependencies to speed up builds
- Publish GitHub Action artifacts to be downloaded locally
1. Get started with GitHub Actions workflows example
It all starts with a GitHub Actions workflow. Here’s how to create a run a workflow in the tool.
2. Explore the GitHub Actions Docker container
This example creates a simple YAML file that runs a few BASH commands to help a developer explore the contents of the Ubuntu runtime the GitHub Actions runner uses.
DevOps professionals who are new to Docker often find the environment intimidating and mysterious. But after they run a few BASH commands in the GitHub Actions YAML file, they’ll soon realize that running a build with a Docker container in the cloud isn’t much different than running the build on a local operating system.
|Your intro to GitHub Actions training course|
Here’s how to get started with GitHub Actions:
Follow these tutorials and you’ll learn GitHub Actions fast.
3. Complex, multi-step GitHub Actions example
A good workflow is broken down into multiple steps. Unfortunately, tutorials often perform many actions in a single step. While that’s great for learning, it’s not good for production. This example will teach developers how to create a multi-step GitHub Actions workflow.
4. Jobs vs. steps in GitHub Action workflow example
Developers are often confused on the difference between a GitHub Actions Job and a step. In this example, we create a multi-job GitHub Action workflow, which contrasts nicely with the multi-step workflow that was previously demonstrated.
5. Linux, Mac and Windows workflows in GitHub example
Developers aren’t limited to Ubuntu when they build GitHub Action workflows. In this example we create a single CI/CD workflow that performs parallel builds on Ubuntu, MacOS and Windows.
6. Run a GitHub Actions shell script tutorial
This GitHub Actions example might not change your life, but developers often run into issues when they attempt to run a GitHub Actions shell script. Here’s how to do it with an Ubuntu image.
7. GitHub Actions environment variables example
Everyone wants to know what environment variables are available for their GitHub Actions scripts. Here’s a look at all of the GitHub Actions environment variables in an Ubuntu image.
8. Java builds, GitHub Actions and Apache Maven example
All the examples up to this point have demonstrated fundamental GitHub Action concepts. However, none of them actually perform a build. Here’s an example of how to build a Java app with GitHub actions and Apache Maven.
9. GitHub Actions cache example
GitHub Actions can run slow if developers must download dependencies every time they run. This GitHub Actions cache example will show you how to improve GitHub Actions performance.
10. Publish GitHub artifacts example
Where do all the build artifacts go after a build? This GitHub Actions Artifacts example shows how to publish the files and resources created during a build so they can be easily downloaded from the workflow’s summary page.
Learn with GitHub Actions examples
If developers can get through these 10 GitHub Actions examples, they’ll understand the basics of CI/CD with GitHub.
Developers can use this as a strong knowledge base and move on to create more complex build jobs that push to Amazon, build multi-device applications and fulfill all of their DevOps needs.