Back to Blog
devops8 min read

CI/CD with GitHub Actions: Build, Test, and Deploy Pipelines

Automating software delivery — build pipelines, testing, Docker image builds, deployment automation, and secrets management with GitHub Actions.

V
By Ventra Rocket
·Published on 15 January 2026
#GitHub Actions#CI/CD#DevOps#Docker#Automation

GitHub Actions makes CI/CD accessible without managing CI servers.

1. Basic Test Pipeline

name: CI/CD Pipeline
on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: "20"
          cache: "npm"
      - run: npm ci
      - run: npm run lint
      - run: npm run test:ci
        env:
          CI: true

2. Docker Build and Push

  build:
    needs: test
    runs-on: ubuntu-latest
    permissions:
      contents: read
      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/metadata-action@v5
        id: meta
        with:
          images: ghcr.io/${{ github.repository }}
          tags: |
            type=sha,prefix=sha-
            type=semver,pattern={{version}}
      - uses: docker/build-push-action@v5
        with:
          context: .
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

3. Matrix Testing

  test-matrix:
    strategy:
      matrix:
        node-version: [18, 20, 22]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm ci && npm test

4. Secrets Best Practices

env:
  DATABASE_URL: ${{ secrets.DATABASE_URL }}
  JWT_SECRET: ${{ secrets.JWT_SECRET }}

Use GitHub Secrets (Settings > Secrets and variables) or external secret managers. Never hardcode credentials in workflow files.

5. Layer Caching

# npm dependency cache
- uses: actions/cache@v4
  with:
    path: ~/.npm
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

# Docker build cache via GHA backend
- uses: docker/build-push-action@v5
  with:
    cache-from: type=gha
    cache-to: type=gha,mode=max

Conclusion

Separate jobs for test/build/deploy. Use environments for production gating. Cache npm and Docker layers for speed. Ventra Rocket reduced deployment time from 30-minute manual steps to 5-minute automated pipelines with GitHub Actions.

Related Articles

CI/CD with GitHub Actions: Build, Test, and Deploy Pipelines | Ventra Rocket