DEV Community

Cover image for Build CI/CD Pipeline in 10 Mins with GitHub Actions
Sudhir Bahadure
Sudhir Bahadure

Posted on

Build CI/CD Pipeline in 10 Mins with GitHub Actions

Introduction

Did you know that 70% of CI/CD pipelines take over an hour to set up, but with GitHub Actions, you can build one in just 10 minutes? In this era of rapid development and deployment, having a seamless Continuous Integration and Continuous Deployment (CI/CD) pipeline is crucial for any project. By the end of this tutorial, you will have built a fully functional CI/CD pipeline using GitHub Actions, which you can use today to automate your deployment process. As we dive into 2026, automating deployment processes is becoming increasingly important for developers to reduce manual errors and increase efficiency. To get started, make sure you have the following prerequisites:

  • A GitHub account
  • A basic understanding of YAML
  • A Python project ready for deployment
  • Docker installed on your machine

Table of Contents

  1. Introduction
  2. Step 1 — Create a GitHub Actions Workflow
  3. Step 2 — Define the Build Process
  4. Step 3 — Automate Deployment
  5. Step 4 — Add Continuous Integration
  6. Step 5 — Monitor and Trigger the Workflow
  7. Real-World Usage
  8. Real-World Application
  9. Conclusion
  10. 💬 Your Turn

Step 1 — Create a GitHub Actions Workflow

Creating a GitHub Actions workflow is the first step in building your CI/CD pipeline. This step matters because it lays the foundation for your automated deployment process.

name: CI/CD Pipeline

on:
  push:
    branches: [ main ]

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
Enter fullscreen mode Exit fullscreen mode

The expected output will be a new workflow file in your repository, which will trigger on every push to the main branch.

Step 2 — Define the Build Process

Defining the build process is crucial for compiling your code into an executable format. This step matters because it ensures your code is compiled correctly before deployment.

# Install dependencies
pip install -r requirements.txt

# Build your project
python setup.py build
Enter fullscreen mode Exit fullscreen mode

The expected output will be a successfully compiled project, ready for deployment.

Step 3 — Automate Deployment

Automating deployment is where GitHub Actions truly shines. This step matters because it saves you time and reduces the risk of human error.

      - name: Deploy to production
        uses: appleboy/scp-action@master
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          source: "./dist"
          target: "/var/www/html"
Enter fullscreen mode Exit fullscreen mode

The expected output will be your project deployed to your production server.

Step 4 — Add Continuous Integration

Adding continuous integration to your pipeline ensures your code is tested and validated on every push. This step matters because it catches bugs early in the development cycle.

      - name: Run tests
        run: |
          python -m unittest discover -s tests
Enter fullscreen mode Exit fullscreen mode

The expected output will be a report showing the results of your unit tests.

Step 5 — Monitor and Trigger the Workflow

Monitoring and triggering the workflow is the final step in creating a fully automated CI/CD pipeline. This step matters because it ensures your pipeline runs smoothly and consistently.

      - name: Monitor workflow
        uses: actions/monitor@v1
        with:
          workflow: ${{ github.workflow }}
          token: ${{ secrets.TOKEN }}
Enter fullscreen mode Exit fullscreen mode

The expected output will be a workflow that triggers automatically on every push to the main branch.

Real-World Usage

Now that you've built your CI/CD pipeline, let's look at a real-world example. Suppose you're building a web application, and you want to automate the deployment process. With GitHub Actions, you can create a workflow that builds, tests, and deploys your application on every push to the main branch.

Real-World Application

The CI/CD pipeline you just built can be used to solve real-world problems, such as automating the deployment of a web application. Relevant tools like Vultr Cloud (Get $100 free credit to host your apps) and DigitalOcean (Get $200 free credit to deploy your code) can be used to host and deploy your application.

Conclusion

Here are three specific takeaways from this tutorial:

  1. GitHub Actions can be used to create a fully automated CI/CD pipeline.
  2. Automating deployment reduces the risk of human error and saves time.
  3. Continuous integration ensures your code is tested and validated on every push. Now that you've built your CI/CD pipeline, consider building a price tracker bot in Python to automate price tracking for your favorite products.

💬 Your Turn

Have you automated your deployment process before? What was your approach? Drop it in the comments — I read every one.

💡 Found this helpful?

If this tutorial saved you time or solved a problem, consider:

  • Support me on Ko-fi
  • Support via PayPal

Every coffee or donation keeps me writing free tutorials like this one!


This article was written with AI assistance and reviewed for technical accuracy.
Part of the **Zero-Cost Cloud & DevOps* series — Follow for more free tutorials*

#aBotWroteThis

Top comments (0)