Complete CI/CD Pipeline with GitHub Actions for Next.js Applications
Automated pipeline configuration with tests, build, preview deploys, and production deployment.
Automate the entire software delivery lifecycle with GitHub Actions, from push to production deployment, including tests, code analysis, and preview environments.
At a glance
Access
Free prompt
Open to copy without upgrading.
Prompt objective
Automate the entire software delivery lifecycle with GitHub Actions, from push to production deployment, including tests, code analysis, and preview environments.
Real use case
A fintech startup currently performs manual deployments via SSH with no automated tests. Their last deployment broke production for 3 hours because a developer forgot to run the tests. They need a pipeline that prevents broken code from reaching production.
Customize these fields first
Replace the placeholders with your own context before you run the prompt. That usually improves the first output more than adding more instructions later.
Prompt
Create a complete CI/CD pipeline with GitHub Actions for [PROJECT NAME], a Next.js [VERSION] application deployed on [VERCEL/AWS/DOCKER + VPS].\\\\\\\\n\\\\\\\\n**Context:**\\\\\\\\n- Repository: monorepo [YES/NO]\\\\\\\\n- Branches: main (production), develop (staging), feature/*\\\\\\\\n- Existing tests: [NUMBER] unit, [NUMBER] E2E\\\\\\\\n- Database: [POSTGRESQL/MYSQL] — migrations required\\\\\\\\n- Environment variables: [NUMBER] secrets\\\\\\\\n\\\\\\\\n**Workflow 1 — Pull Request (CI):**\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`yaml\\\\\\\\n# Trigger: push to any branch except main\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\n- Checkout + node_modules cache (pnpm store)\\\\\\\\n- Type checking: \\\\\\\\\\\\\\\\\\\\\\\`tsc --noEmit\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\n- Linting: ESLint + Prettier check\\\\\\\\n- Unit tests: Jest/Vitest with coverage report\\\\\\\\n- E2E tests: Playwright with failure screenshots\\\\\\\\n- Verification build: \\\\\\\\\\\\\\\\\\\\\\\`next build\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\n- Automatic preview deployment (unique URL per PR)\\\\\\\\n- Automatic PR comment with: preview link, coverage %, bundle size diff\\\\\\\\n- Mandatory status checks for merge\\\\\\\\n\\\\\\\\n**Workflow 2 — Merge to main (CD):**\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`yaml\\\\\\\\n# Trigger: push to main\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\n- All CI checks\\\\\\\\n- Database migrations (with automatic rollback on failure)\\\\\\\\n- Optimized production build\\\\\\\\n- Deploy to [ENVIRONMENT]\\\\\\\\n- Post-deploy smoke tests (health check + critical endpoints)\\\\\\\\n- Slack/Discord notification: success or failure\\\\\\\\n- Automatic semantic versioning tag\\\\\\\\n\\\\\\\\n**Workflow 3 — Scheduled (Maintenance):**\\\\\\\\n- Dependabot/Renovate: dependency updates\\\\\\\\n- Weekly security audit (\\\\\\\\\\\\\\\\\\\\\\\`pnpm audit\\\\\\\\\\\\\\\\\\\\\\\`)\\\\\\\\n- Lighthouse CI: performance monitoring\\\\\\\\n- Database backup verification\\\\\\\\n\\\\\\\\n**Advanced Configuration:**\\\\\\\\n- Matrix strategy for testing on Node 18 and 20\\\\\\\\n- Concurrency: cancel previous workflows on the same branch\\\\\\\\n- Docker layer caching (if applicable)\\\\\\\\n- Secrets management: GitHub Environments (staging, production)\\\\\\\\n- Recommended branch protection rules\\\\\\\\n\\\\\\\\nProvide complete, functional YAML files for each workflow.
Open directly in an AI — the text is pre-filled:
How to use this prompt
- 1Replace the key placeholders first: PROJECT NAME, VERSION, VERCEL/AWS/DOCKER + VPS, YES/NO.
- 2Replace any bracketed placeholders like [this] with your own context.
- 3Add extra background information when you want more tailored results.
- 4Combine multiple prompts in one conversation when you need a richer output.
- 5Save your best-performing prompts so they are easy to reuse later.
Next best step
Open the guide first, then branch only if you still need more.
A guide for technical builders choosing between prompts, coding workflows, and agent-based implementation.
If this prompt is close but not quite right, generate variants next. If the job is recurring, move into the course library after the guide.
Related prompts
View allDocker Containerization and Docker Compose Orchestration for Production
Optimized Dockerfiles and docker-compose for development and production environments.
Best for
Create a containerized environment that ensures parity between development and production, with optimized builds, multi-stage builds, and security configurations.
Monitoring and Observability Setup with Grafana, Prometheus, and Alerts
Complete monitoring stack setup with metrics, logs, and alerts for production applications.
Best for
Implement full observability that detects issues before users notice them, with actionable dashboards and intelligent alerting.
Infrastructure as Code with Terraform for AWS/Hetzner
Automated cloud infrastructure provisioning with Terraform, reusable modules, and state management.
Best for
Automate provisioning of all infrastructure required for a production application, ensuring reproducibility, version control, and compliance.
Incident Response Playbook for Engineering Teams
Structured process for detection, response, communication, and postmortem for production incidents.
Best for
Establish a clear incident response process that minimizes detection and resolution time (MTTR), protects user experience, and generates learnings for the team.
Explore other prompt categories
Move sideways into adjacent libraries when the current category is not the full answer.
Free browsing stays open. Premium prompts unlock the reusable workflow layer.
Use the guides and role paths to validate the job first. Upgrade when you want the full prompt text, editable premium prompts, and the surrounding course paths in one place.
Free access
- Browse guides, role paths, and category pages.
- Preview prompts before you decide to upgrade.
- Find the right starting point without friction.
Membership access
- Unlock premium prompts and the full copy text.
- See more workflow paths and course connections.
- Keep the reusable templates in one place.