Reusable DevSecOps pipeline template with GitHub Actions, automated security scanning, testing, and multi-platform deployment
This repository provides a complete DevSecOps CI/CD pipeline template that can be easily integrated into any JavaScript/Node.js project. The pipeline implements industry best practices for security, testing, and deployment automation.
- π‘οΈ Automated Security Auditing - Dependency scanning and vulnerability detection
- π§ͺ Comprehensive Testing Pipeline - Unit, integration, and coverage testing
- ποΈ Multi-stage Build Process - Optimized builds with artifact management
- π Multi-Platform Deployment - Vercel, GitHub Pages, and custom targets
- π Performance Monitoring - Build metrics and deployment tracking
- π Security Headers - CSP, HSTS, and modern security implementations
- π Reusable Workflows - Easy integration into existing projects
graph TD
A[π₯ Trigger: Push/PR] --> B[π Security Audit]
B --> C[π§Ή Code Quality Check]
C --> D[π§ͺ Run Tests]
D --> E[π Coverage Report]
E --> F[ποΈ Build Application]
F --> G[π¦ Create Artifacts]
G --> H{Branch?}
H -->|main| I[π Production Deploy]
H -->|PR| J[π Preview Deploy]
I --> K[π Notifications]
J --> K
Copy these files to your project:
# Create workflow directory
mkdir -p .github/workflows
# Copy main pipeline
curl -o .github/workflows/ci-cd.yml https://raw.githubusercontent.com/iabreuIjam99/devsecops-pipeline-template/main/.github/workflows/ci-cd.yml
# Copy deployment workflow (optional)
curl -o .github/workflows/deploy.yml https://raw.githubusercontent.com/iabreuIjam99/devsecops-pipeline-template/main/.github/workflows/deploy.ymlUpdate the pipeline configuration in .github/workflows/ci-cd.yml:
env:
NODE_VERSION: '18' # Change to your Node.js version
BUILD_COMMAND: 'npm run build' # Your build command
TEST_COMMAND: 'npm run test:run' # Your test commandFor Vercel deployment, add these secrets to your GitHub repository:
VERCEL_TOKEN- Your Vercel tokenVERCEL_ORG_ID- Your Vercel organization IDVERCEL_PROJECT_ID- Your Vercel project ID
Copy and customize the security configuration:
curl -o vercel.json https://raw.githubusercontent.com/iabreuIjam99/devsecops-pipeline-template/main/vercel.json- npm audit: Dependency vulnerability scanning
- ESLint: Code quality and security linting
- Risk Assessment: Configurable security thresholds
- Unit Tests: Component and function testing
- Integration Tests: End-to-end workflow testing
- Coverage Reports: Test coverage analysis with artifacts
- Production Build: Optimized application building
- Asset Optimization: Image and bundle optimization
- Artifact Management: Build output preservation
- Preview Deployments: PR-based preview environments
- Production Deployment: Main branch automatic deployment
- Multi-Platform: Support for Vercel, GitHub Pages, AWS, etc.
- β React (Vite, CRA, Next.js)
- β Vue.js (Vite, Nuxt.js)
- β Angular
- β Svelte/SvelteKit
- β Static Sites (HTML/CSS/JS)
- β Vitest
- β Jest
- β Cypress
- β Playwright
- β Testing Library
- β Vercel
- β GitHub Pages
- β AWS S3/CloudFront
- β Netlify
- β Azure Static Web Apps
| Variable | Description | Default | Required |
|---|---|---|---|
NODE_VERSION |
Node.js version | 18 |
No |
BUILD_COMMAND |
Build command | npm run build |
No |
TEST_COMMAND |
Test command | npm run test:run |
No |
AUDIT_LEVEL |
Security audit level | moderate |
No |
{
"headers": [
{
"source": "/(.*)",
"headers": [
{"key": "X-Content-Type-Options", "value": "nosniff"},
{"key": "X-Frame-Options", "value": "DENY"},
{"key": "Strict-Transport-Security", "value": "max-age=31536000"}
]
}
]
}The pipeline provides comprehensive metrics:
- β±οΈ Build Duration: Average execution time tracking
- π Test Coverage: Coverage percentage reporting
- π Security Score: Vulnerability assessment results
- π¦ Bundle Size: Asset size optimization tracking
- π Deployment Status: Success/failure rates
-
Shift-Left Security
- Early vulnerability detection
- Automated security scanning
- Security-first pipeline design
-
Test Automation
- Multi-level testing strategy
- Coverage requirements
- Automated test execution
-
Infrastructure as Code
- Version-controlled pipelines
- Reproducible environments
- Environment parity
-
Continuous Integration
- Automated builds
- Quality gates
- Fast feedback loops
-
Continuous Deployment
- Automated deployments
- Preview environments
- Rollback capabilities
# Minimal configuration for React/Vite
env:
NODE_VERSION: '18'
BUILD_COMMAND: 'npm run build'
TEST_COMMAND: 'npm run test:run'# Configuration for Next.js
env:
NODE_VERSION: '18'
BUILD_COMMAND: 'npm run build'
TEST_COMMAND: 'npm run test'# Configuration for Vue.js
env:
NODE_VERSION: '18'
BUILD_COMMAND: 'npm run build'
TEST_COMMAND: 'npm run test:unit'- Setup Guide - Detailed setup instructions
- Configuration Reference - All configuration options
- Deployment Guide - Platform-specific deployment guides
- Troubleshooting - Common issues and solutions
- Examples - Real-world implementation examples
Contributions are welcome! Please read our Contributing Guide for details on:
- Code of Conduct
- Development Process
- Pull Request Process
- Issue Reporting
This project is licensed under the MIT License - see the LICENSE file for details.
This pipeline is actively used in production by:
- DevSecOps Portfolio: Live Demo | Source
- Enterprise Projects: Multiple client implementations
- Open Source Projects: Community adoptions
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: Contact Form
Created by: Isai Abreu | DevSecOps Engineer Jr
License: MIT | Version: 1.0.0
π Ready to implement DevSecOps in your projects? Start with this template and customize for your needs!