GitHub Actions for Seamless CI/CD

05 / Feb / 2024 by Sudarshan Tanwar 0 comments


Github Actions is an automation platform that is provided by Github. Using Github Actions, you can Automate, customize, and execute your software development workflows in your GitHub repository. GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request to your repository or deploy merged pull requests to production.

GitHub Actions goes beyond DevOps and lets you run workflows when other events happen in your repository. For example, you can run a workflow to automatically add the appropriate labels whenever someone creates a new issue in your repository, check if a new branch name is given according to the given standards, etc.

You can control and automate your build/deployment process using GitHub Actions. A GitHub Action workflow will be triggered when an event occurs, such as pushing the code, creating a branch, etc.  

The components of GitHub Actions

1. Workflow – Github actions workflow is a set of instructions in a yaml file. You can create as many workflows as you want. But all those workflows should be inside .github/workflows directory in your code repository.

2. Event – An event is a specific activity in a repository that triggers a workflow run. For example creating a branch or pushing your code etc. There is a huge list of events that can trigger a workflow run.

See here –

3. Job – A job is a set of steps in a workflow that is executed on the same runner. Each step is either a shell script that will be executed, or an action that will be run. Steps are executed in order and are dependent on each other. Since each step is executed on the same runner, you can share data from one step to another. For example, you can have a step that builds your application followed by a step that tests the application that was built.

4. Action – An action is a custom application for the GitHub Actions platform that performs a complex but frequently repeated task. An action can pull your git repository from GitHub, set up the correct toolchain for your build environment, or set up the authentication to your cloud provider.

5. Runner – A runner is a server that runs your workflows when they’re triggered. Each runner is a fresh, newly allocated virtual machine. GitHub provides Ubuntu Linux, Microsoft Windows, and macOS runners to run your workflows; Each runner can run a single job at a time.

Example of a workflow file:

How to create a workflow file?

You have to create a .github/workflows folder in your project root folder. Create your workflow as a YAML file inside that workflow folder.

How to run a GitHub workflow?

You don’t need to run a workflow manually. Based on a given event trigger, the workflow will start to run automatically and execute the commands defined in that workflow.

How to check the status of the running workflow?

You can see all your workflows running on the GitHub website itself.


Workflow templates

If you are thinking about writing your first workflow from scratch, then GitHub already offers a huge collection of mostly used workflows for different requirements. You can see all available workflow templates here:

Now, create your first workflow & start using GitHub Actions for your software development workflow.

Best of luck!


Leave a Reply

Your email address will not be published. Required fields are marked *