CI/CD Pipeline with GitHub Actions

Mon, June 2, 2025 - 1 min read

GitHub Actions automates software workflows directly from your repository. This guide walks through setting up a CI/CD pipeline.

What is GitHub Actions?

GitHub Actions uses YAML-based workflows triggered by events like pushes, pull requests, or scheduled times. Workflows run on GitHub-hosted or self-hosted runners.

Basic Workflow Structure

Create .github/workflows/ci.yml:

name: CI Pipeline
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
 
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run tests
        run: npm test

Key Concepts

  • Workflow — one or more jobs defined in a YAML file
  • Job — a set of steps that run on the same runner
  • Step — an individual task (command or action)
  • Action — reusable unit of code (community or custom)

Deployment Example

deploy:
  needs: build
  runs-on: ubuntu-latest
  steps:
    - name: Deploy to server
      run: |
        scp -r dist/ user@server:/var/www/

GitHub Actions makes CI/CD accessible and keeps your deployments consistent and automated.