Skip to main content

Command Palette

Search for a command to run...

Understanding CI/CD with GitHub Actions: Core Concepts Every DevOps Engineer Must Know

Updated
3 min read

Introduction

Modern DevOps is not about writing YAML files — it’s about designing reliable, secure, and maintainable CI/CD pipelines.

As part of my DevOps upskilling journey, I’ve been deep-diving into GitHub Actions, focusing on understanding how pipelines actually work internally, rather than just copying templates.

In this blog, I’m sharing the core CI/CD concepts behind GitHub Actions, with simple explanations and examples that reflect real-world pipeline design.


1. What is GitHub Actions in CI/CD?

GitHub Actions is an event-driven CI/CD automation platform built directly into GitHub.

At a high level:

Event (push / PR)
   ↓
Workflow triggered
   ↓
Jobs executed on runners
   ↓
Steps run sequentially

The key idea is automation based on events, not manual execution.


2. Workflow, Jobs, Steps & Runners

Workflow

  • Defined under .github/workflows/*.yml

  • Represents a CI or CD process

Jobs

  • Logical stages like build, test, deploy

  • Each job runs on a separate runner

Steps

  • Individual commands or reusable actions

  • Steps inside a job share the same filesystem

Runners

  • Ephemeral virtual machines

  • Destroyed after job completion

Example:

name: CI Example

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Hello CI"

3. Contexts & Expressions (Dynamic Pipelines)

GitHub Actions uses contexts to access runtime information.

Most commonly used contexts:

  • github → repo, branch, event info

  • env → environment variables

  • steps → step outputs

  • needs → job dependencies and outputs

Expressions use this syntax:

${{ github.ref }}

This allows pipelines to behave dynamically, based on runtime data.


4. Job Outputs: Passing Data Between Jobs

Jobs are isolated, so GitHub Actions provides job outputs to pass small metadata values.

Step output:

- id: tag
  run: echo "image_tag=v1.0.0" >> $GITHUB_OUTPUT

Job output:

outputs:
  image_tag: ${{ steps.tag.outputs.image_tag }}

Consuming in another job:

${{ needs.build.outputs.image_tag }}

Use case:

  • Docker image tags

  • Version numbers

  • Environment decisions


5. Artifacts: Passing Files Between Jobs

Artifacts are used when files need to move across jobs.

Example use cases:

  • Build outputs

  • Test reports

  • Generated manifests

- uses: actions/upload-artifact@v4
  with:
    name: build-files
    path: dist/

Artifacts enable multi-stage pipelines where build and deploy are separated.


6. Environment Variables vs Secrets

Environment Variables

Used for non-sensitive configuration:

env:
  APP_ENV: staging

Secrets

Used for sensitive data:

  • Tokens

  • Passwords

  • Cloud credentials

${{ secrets.DOCKER_PASSWORD }}

Secrets are:

  • Encrypted

  • Masked in logs

  • Injected only at runtime


7. Conditions & Control Flow (if:)

Conditions allow pipelines to run intelligently.

Examples:

Run deployment only on main branch:

if: github.ref == 'refs/heads/main'

Deploy only if build succeeds:

if: needs.build.result == 'success'

Special functions:

  • always()

  • success()

  • failure()

This enables safe and controlled CI/CD execution.


Key Learnings

  • CI/CD pipelines are event-driven systems

  • Jobs are isolated by design

  • Outputs and artifacts enable safe communication

  • Secrets and conditions are critical for production readiness


Next Steps

I’m currently extending this learning into:

  • Docker-based CI pipelines

  • Kubernetes deployments

  • Helm-based releases

  • GitHub Actions → AWS (EKS)

  • Secure pipelines using OIDC

  • Failure handling and rollback strategies


Conclusion

Understanding GitHub Actions deeply has helped me think beyond YAML and focus on pipeline architecture, security, and reliability — which are core expectations in DevOps roles.

If you’re learning CI/CD, I highly recommend focusing on why pipelines work the way they do, not just how to write them.

More from this blog

Rasika DevOps

13 posts