Skip to main content

Command Palette

Search for a command to run...

🚀Hands-on CI/CD with GitHub Actions (Beginner Friendly)

Published
3 min read
🚀Hands-on CI/CD with GitHub Actions (Beginner Friendly)
V

👩‍💻 Aspiring DevOps & Cloud Engineer | Learning in Public | Automation Enthusiast Hi! I’m Vaishnavi Landge, documenting my journey into DevOps, Cloud, CI/CD, and automation. I believe in learning by doing — this blog is my daily space to simplify concepts, share projects, and grow step by step. 🚀 Let’s build, automate, and deploy — together!

In the last blog, we learned what CI/CD is and why it’s important.
Now, let’s actually build a small CI/CD pipeline using GitHub Actions.

Before jumping to the hands-on, let’s first understand:
👉 What exactly are we writing in a pipeline?
👉 How is it different from normal programming code?


🔹 Code vs. Pipeline Instructions

When you write code (Python, Java, etc.), you are solving a problem:

  • Example: Write code to add numbers from 1 to 20.

  • Here, your logic decides what the output will be.

But when you write a GitHub Actions pipeline, you are not solving a math problem.
Instead, you are writing instructions for automation.

Think of it like giving step-by-step tasks to a robot:

  • Step 1 → Take the code from GitHub.

  • Step 2 → Run tests.

  • Step 3 → Build the project.

  • Step 4 → Deploy it somewhere.

So a pipeline is basically a to-do list for machines, written in a special format(.yml file).


🔹 Our First Simple Pipeline

Here’s a small pipeline:

name: Simple CI Pipeline

on:
  push:
    branches: [ "main" ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Run a simple script
        run: echo "Hello, CI/CD is working!"

🔹 Breaking It Down

  • name → Just gives a title to the workflow.

  • on: push → This tells GitHub when to run the pipeline.
    👉 In this case: whenever someone pushes code to the main branch.

  • jobs → A job is a group of tasks that will run.

  • runs-on → Which environment to run on (we chose ubuntu-latest).

  • steps → The actual instructions:

    • Checkout code (get the repo code).

    • Run a script (print Hello, CI/CD is working!).


🔹 What Will Happen When It Runs?

When you push code to the main branch:

  1. GitHub creates a fresh Ubuntu server.

  2. It pulls your repository code into that server.

  3. It executes the step → prints:

     Hello, CI/CD is working!
    

So the output you see is simply the log of whatever tasks you wrote.


🔹 Why This Example?

This example is very basic — we are only printing a message.
But the idea is:

  • If you can run echo, you can also run tests, builds, or deployments.

  • The same steps can later be replaced with:

    • Run unit tests (pytest, npm test, etc.).

    • Build Docker images.

    • Deploy to AWS, GCP, or Azure.


🔹 Conclusion

CI/CD pipelines are not about writing logic like in programming.
They are about writing automation steps that handle your code.

👉 Our first workflow just printed a message, but it shows the structure.
👉 In the next blog, we’ll extend this to run tests and build something real.