Back to Blog
2025-03-10Abyan Dimas

Building Your First CI/CD Pipeline with GitHub Actions

CI/CD Pipeline

Manual deployments are risky. CI/CD (Continuous Integration/Continuous Deployment) removes human error. GitHub Actions makes this free and easy.

The Workflow File

Create .github/workflows/ci.yml.

name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v3
    
    - name: Use Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '18.x'
        
    - name: Install dependencies
      run: npm ci
      
    - name: Run Tests
      run: npm test
      
    - name: Build
      run: npm run build

What does this do?

  1. Trigger: Runs on every push to the repository.
  2. Environment: Spins up a virtual Ubuntu server.
  3. Steps: Checks out code, installs Node, installs dependencies, runs tests, and builds the app.

If any step fails (e.g., a test breaks), GitHub will alert you, and you (or your team) won't merge the broken code. That is the power of CI.

Share this article

Read Next