Skip to main content

Command Palette

Search for a command to run...

How to Build a CI/CD Pipeline Using GitHub Actions (Step-by-Step)

A beginner-friendly guide to automating builds and deployments

Updated
2 min read
L

I build and deploy cloud-native applications using AWS and DevOps practices. I share practical tutorials on CI/CD pipelines, serverless architectures, and real project learnings, and I’m exploring MLOps.

  • Introduction

  • What is CI/CD?

  • Why GitHub Actions

  • Basic CI/CD Flow

  • Sample GitHub Actions Workflow

  • What I Learned

  • Conclusion

Introduction

In modern software development, manually building and deploying applications is time-consuming and error-prone. CI/CD helps automate this process and ensures faster, reliable deployments.

In this blog, I’ll explain how to build a simple CI/CD pipeline using GitHub Actions, based on how I implemented it in my own project. This guide is beginner-friendly and focuses on practical steps rather than theory.

What is CI/CD ?

CI/CD stands for Continuous Integration and Continuous Deployment.
Continuous Integration automatically builds and tests code when changes are pushed, while Continuous Deployment automatically deploys the application after successful builds.

Why GitHub Actions

GitHub Actions is a CI/CD tool built directly into GitHub. It allows us to automate workflows such as building, testing, and deploying applications whenever code is pushed to a repository.

It is easy to set up, free for small projects, and integrates well with cloud platforms.

Basic CI/CD Flow

The basic CI/CD flow using GitHub Actions looks like this:

  1. Developer pushes code to GitHub

  2. GitHub Actions workflow is triggered

  3. Application is built and tested

  4. Deployment step runs automatically

Sample GitHub Actions Workflow File:

GitHub Actions workflows are defined using YAML files inside the .github/workflows directory.

Below is the simple GitHub action Yaml file:

  1. name: The name of the workflow.

  2. on: Defines when the workflow should run.

  3. push: Triggers the pipeline whenever code is pushed.

  4. branches: Specifies which branch should trigger the workflow.

  5. main: The pipeline runs only when changes are pushed to the main branch.

  6. jobs: Contains one or more jobs that will run in the workflow.

  7. build: The name of the job (you can name it anything).

  8. runs-on: Specifies the operating system for the job.

  9. ubuntu-latest: Uses the latest Ubuntu runner provided by GitHub.

  10. steps: A sequence of tasks that will be executed one by one inside the job.

  11. name: A readable label for the step.

  12. uses: Runs a prebuilt GitHub Action.

  13. actions/checkout@v3: Checks out the repository code so the workflow can access it.

  14. run: Executes shell commands.

What I Learned

By implementing this CI/CD pipeline, I learned how GitHub Actions automates workflows, reduces manual effort, and improves deployment reliability. Even a basic pipeline can significantly improve development speed and confidence.

Conclusion

This blog covered the basics of setting up a CI/CD pipeline using GitHub Actions. This is a starting point, and the pipeline can be extended further based on project requirements.