CI/CD Pipeline Configuration Generator

Generate production-ready CI/CD pipeline configurations for GitHub Actions, GitLab CI, or other platforms with testing, linting, building, and deployment stages.

Prompt Template

You are a senior DevOps engineer who has built CI/CD pipelines for hundreds of production applications. Generate a production-ready CI/CD pipeline configuration for the following project:

**Project Type:** [e.g., Next.js app, Python API, React Native app, Go microservice]
**CI/CD Platform:** [GitHub Actions / GitLab CI / CircleCI / Jenkins / other]
**Hosting/Deployment Target:** [e.g., Vercel, AWS ECS, Google Cloud Run, DigitalOcean, self-hosted]
**Package Manager:** [npm, yarn, pnpm, pip, go mod, etc.]
**Testing Framework:** [e.g., Jest, Vitest, pytest, Go test]
**Linting/Formatting:** [e.g., ESLint + Prettier, Ruff, golangci-lint]
**Branch Strategy:** [e.g., main = production, develop = staging, feature branches]
**Environment Variables/Secrets Needed:** [list any — e.g., DATABASE_URL, API_KEY, AWS credentials]
**Additional Requirements:** [e.g., Docker build, database migrations, Slack notifications, preview deployments]

Generate:

1. **Complete pipeline configuration file** — Ready to copy-paste with comments explaining each step
2. **Pipeline stages breakdown:**
   - 🔍 Lint & Format Check
   - 🧪 Test (with coverage reporting)
   - 🏗️ Build
   - 🚀 Deploy (staging on develop push, production on main push)
   - 📢 Notifications (success/failure)
3. **Secrets setup guide** — What to add in the CI/CD platform's secret management
4. **Caching strategy** — Dependency and build caching for fastest possible runs
5. **Branch protection rules** — Recommended settings to enforce the pipeline
6. **Troubleshooting guide** — Common failures and how to fix them

Example Output

# GitHub Actions CI/CD Pipeline — Next.js on Vercel

1. Pipeline Configuration

# .github/workflows/ci-cd.yml

name: CI/CD Pipeline

on:

push:

branches: [main, develop]

pull_request:

branches: [main, develop]

env:

NODE_VERSION: '20'

PNPM_VERSION: '9'

jobs:

lint:

name: 🔍 Lint & Format

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

with:

version: ${{ env.PNPM_VERSION }}

- uses: actions/setup-node@v4

with:

node-version: ${{ env.NODE_VERSION }}

cache: 'pnpm'

- run: pnpm install --frozen-lockfile

- run: pnpm lint

- run: pnpm format:check

test:

name: 🧪 Test

runs-on: ubuntu-latest

needs: lint

steps:

- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

with:

version: ${{ env.PNPM_VERSION }}

- uses: actions/setup-node@v4

with:

node-version: ${{ env.NODE_VERSION }}

cache: 'pnpm'

- run: pnpm install --frozen-lockfile

- run: pnpm test -- --coverage

- uses: actions/upload-artifact@v4

with:

name: coverage

path: coverage/

deploy-staging:

name: 🚀 Deploy Staging

runs-on: ubuntu-latest

needs: [lint, test]

if: github.ref == 'refs/heads/develop' && github.event_name == 'push'

steps:

- uses: actions/checkout@v4

- 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 }}

deploy-production:

name: 🚀 Deploy Production

runs-on: ubuntu-latest

needs: [lint, test]

if: github.ref == 'refs/heads/main' && github.event_name == 'push'

environment: production

steps:

- uses: actions/checkout@v4

- 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'

4. Caching Strategy

pnpm's cache is handled by `actions/setup-node` with `cache: 'pnpm'`. This typically reduces install time from ~45s to ~8s.

For Next.js build cache, add:

- uses: actions/cache@v4

with:

path: .next/cache

key: nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('**/*.ts', '**/*.tsx') }}

restore-keys: nextjs-${{ hashFiles('pnpm-lock.yaml') }}-

...

Tips for Best Results

  • 💡Always use --frozen-lockfile (or equivalent) in CI to catch lockfile drift before it hits production
  • 💡Cache dependencies AND build artifacts separately — they have different invalidation patterns
  • 💡Add a 'paths' filter to skip CI for docs-only changes: on.push.paths-ignore: ['**.md', 'docs/**']
  • 💡Use GitHub Actions environments with required reviewers for production deploys — it's free branch protection