← Back to Home
⚙️

Introduction to GitHub Actions

Automate your build, test, and deploy — without leaving GitHub.

9 min read📚DevOps Fundamentals

Every time you push code, a series of checks should run: build it, test it, maybe deploy it. Doing that by hand is slow and easy to forget. GitHub Actions automates it — running your pipeline automatically on every push, directly inside your repository. This is CI/CD.


🎯 Learning Objectives

By the end of this lesson you will:


What is CI/CD?

Term Meaning
CI — Continuous Integration Automatically build and test every change as it’s merged
CD — Continuous Delivery/Deployment Automatically release that tested change to an environment

The goal: catch problems early and ship reliably, without manual, error-prone steps.

💡 The one-line version

CI/CD is a robot that builds, tests, and ships your code every time you push — so humans don’t have to remember to.


What is GitHub Actions?

GitHub Actions is GitHub’s built-in automation platform. You describe a workflow in a YAML file inside your repo, and GitHub runs it automatically when chosen events happen — a push, a pull request, a schedule, and more.

Because it lives in your repo, there’s nothing extra to host — GitHub provides the machines (runners) that execute your workflows.


The Core Concepts

text
Event (push)  ──triggers──▶  Workflow
                            └─ Job (runs on a runner)
                                 └─ Step 1: checkout code
                                 └─ Step 2: install deps
                                 └─ Step 3: run tests
Concept What it is
Workflow The whole automated process (one YAML file)
Event What triggers it (push, pull_request, schedule)
Job A set of steps that run on one runner
Step A single task (run a command or use an action)
Runner The machine that executes a job
Action A reusable, pre-built step you can drop in

Where Workflows Live

Workflow files go in a special folder: .github/workflows/. A minimal one:

yaml
# .github/workflows/hello.yml
name: Hello
on: push

jobs:
greet:
  runs-on: ubuntu-latest
  steps:
    - run: echo "Hello from GitHub Actions!"

Push this file, and GitHub runs the job automatically. You’ll see the result under the repo’s Actions tab.

bash — 80×24
student@devops:~$git add .github/workflows/hello.yml && git commit -m 'add workflow' && git push

The Marketplace Advantage

You rarely start from scratch. The GitHub Marketplace has thousands of pre-built actions — checkout code, set up Node/Python, cache dependencies, deploy to a cloud — that you reference with uses:.

yaml
steps:
- uses: actions/checkout@v4        # check out your repo
- uses: actions/setup-node@v4      # install Node.js
  with:
    node-version: 20

💡 uses vs run

run: executes a shell command. uses: pulls in a reusable action someone already built. Combining them is how you assemble powerful pipelines quickly.


🧪 Hands-on Lab

📝

Create Your First Workflow

  1. Add a workflow file at .github/workflows/ci.yml triggered on push
  2. Add a job that checks out the code and prints the repository contents
  3. Push it and check the Actions tab for a green run

🧠 Knowledge Check

Knowledge Check

What does Continuous Integration (CI) primarily do?

Knowledge Check

Where must GitHub Actions workflow files be placed?


💼 Interview Preparation

Interview Q&A

What are the benefits of CI/CD, and how does GitHub Actions provide it?


Summary

You now understand CI/CD, what GitHub Actions is, and its core building blocks: workflows, events, jobs, steps, and runners. Next, you’ll break down the anatomy of a workflow file in detail.

Up Next

Workflow Anatomy

You've mastered this lesson. Continue your journey to becoming a DevOps Engineer.

Start Next Lesson