Back to Blog
    DevOps

    GitHub Actions CI/CD Pipeline: Complete Guide to Automating Your Deployments in 2026

    Mortex SolutionsApril 1, 202611 min read
    GitHub Actions CI/CD Pipeline: Complete Guide to Automating Your Deployments in 2026

    GitHub Actions has become the #1 CI/CD platform for developers. In 2026, it handles everything from linting and testing to building Docker images and deploying to production — all from your repository.

    GitHub Actions CI/CD automation

    🔧 Basic CI Workflow

    # .github/workflows/ci.yml
    name: CI Pipeline
    
    on:
      push:
        branches: [main, develop]
      pull_request:
        branches: [main]
    
    jobs:
      test:
        runs-on: ubuntu-latest
        strategy:
          matrix:
            node-version: [18, 20, 22]
        
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: ${{ matrix.node-version }}
              cache: 'npm'
          
          - run: npm ci
          - run: npm run lint
          - run: npm run type-check
          - run: npm test -- --coverage
          
          - uses: actions/upload-artifact@v4
            with:
              name: coverage-${{ matrix.node-version }}
              path: coverage/

    🚀 Auto-Deploy to Vercel

    # .github/workflows/deploy.yml
    name: Deploy to Production
    
    on:
      push:
        branches: [main]
    
    jobs:
      deploy:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: 22
              cache: 'npm'
          
          - run: npm ci
          - run: npm run build
          - run: npm test
          
          - uses: amondnet/vercel-action@v25
            with:
              vercel-token: ${{ secrets.VERCEL_TOKEN }}
              vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
              vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
              vercel-args: '--prod'

    🐳 Docker Build & Push

    # Build and push Docker image to GitHub Container Registry
      docker:
        runs-on: ubuntu-latest
        permissions:
          packages: write
        steps:
          - uses: actions/checkout@v4
          - uses: docker/login-action@v3
            with:
              registry: ghcr.io
              username: ${{ github.actor }}
              password: ${{ secrets.GITHUB_TOKEN }}
          
          - uses: docker/build-push-action@v5
            with:
              push: true
              tags: ghcr.io/${{ github.repository }}:latest
              cache-from: type=gha
              cache-to: type=gha,mode=max

    💡 Pro Tips

    • Cache dependencies — Use actions/cache or built-in setup-node caching for 50-70% faster builds
    • Matrix builds — Test across Node 18/20/22 in parallel
    • Branch protection — Require CI to pass before merging PRs
    • Secrets — Never hardcode tokens; use GitHub Secrets and OIDC
    • Reusable workflows — DRY your CI config across repos with workflow_call

    🎯 Start Here: Every project should have at minimum: lint → type-check → test → build. Add deploy only after your test suite is reliable. GitHub Actions' free tier (2,000 minutes/month) is enough for most teams.