CI/CD Pipeline Overview

This document describes the newly added GitHub Actions workflow (.github/workflows/webpack.yml) for building and packaging our NodeJS application with Webpack. It covers workflow triggers, build matrix, job steps, artifact handling, and how this integrates into our CI/CD process.

Workflow Triggers

The workflow runs on two events targeting the main branch:

  • push: Executes on any commit pushed to main.
  • pull_request: Executes when a PR targets main.

This ensures that every change to main—whether merged directly or via PR—is automatically built and validated.

Build Strategy

This workflow uses a matrix strategy to test multiple NodeJS versions in parallel:

Node Version
18.x
20.x

Each matrix entry spins up an ubuntu-latest runner to verify compatibility across supported NodeJS environments.

Job Steps

The build job runs on each matrix entry and consists of the following steps:

  1. Checkout repository
   - name: Checkout code
     uses: actions/checkout@v3
  1. Set up NodeJS
   - name: Setup Node.js
     uses: actions/setup-node@v3
     with:
       node-version: ${{ matrix.node-version }}
  1. Download prior artifact
   - name: Download a Build Artifact
     uses: actions/[email protected]
     with:
       path: build-artifacts
  1. Install dependencies
   - name: Install dependencies
     run: npm ci
  1. Run Webpack build
   - name: Build with Webpack
     run: npm run build
  1. Upload build output
   - name: Upload Webpack bundle
     uses: actions/upload-artifact@v3
     with:
       name: webpack-build
       path: dist/

Artifact Handling 📦

This workflow both downloads and uploads build artifacts to support multi-stage pipelines:

  • Download: Uses actions/[email protected] to pull artifacts (e.g., shared assets) from previous runs or workflows.
  • Upload: Uses actions/upload-artifact@v3 to store the generated Webpack bundles (dist/) for downstream jobs or release workflows.

Artifact inputs include:

Input Description
name Artifact identifier (e.g., webpack-build)
path Filesystem path to (download/upload) artifacts
github-token Token for cross-repo or cross-run authentication (optional)
merge-multiple Whether to merge multiple downloaded artifacts into one folder

Pipeline Integration

flowchart TD
  A[Developer push / PR] --> B[NodeJS with Webpack Workflow]
  B --> C{Matrix Runs}
  C --> C1[Node 18.x Build]
  C --> C2[Node 20.x Build]
  C1 --> D[Download Artifact]
  C2 --> D
  D --> E[Install & Build]
  E --> F[Upload Webpack Bundle]
  F --> G[Release / Deployment Workflows]

This workflow is a key stage in our CI/CD pipeline:

  • It verifies code changes on main against supported Node versions.
  • It produces versioned webpack-build artifacts.
  • Downstream workflows (e.g., deployment or release) consume these artifacts to deploy to staging or production.

By automating build, test, and artifact management, we maintain consistency and reliability across all deployments.