Create a GitHub Actions CI/CD Workflow for Automated Testing and Deployment

Generate a complete GitHub Actions CI/CD workflow with build, test, deploy, and notification jobs for your project.

๐Ÿ“ The Prompt

Create a production-ready GitHub Actions workflow file (.yml) for a [LANGUAGE/FRAMEWORK] project hosted on GitHub. The workflow should automate the CI/CD pipeline with the following requirements: 1. **Trigger Configuration**: Set up triggers for push events on the [BRANCH_NAME] branch and pull requests targeting that branch. Include a manual workflow_dispatch trigger with an input parameter for selecting the deployment environment ([ENVIRONMENTS_LIST]). 2. **Build & Test Job**: - Use [RUNNER_OS] as the runner. - Check out the code and set up the [LANGUAGE/FRAMEWORK] environment with version [VERSION]. - Cache dependencies (e.g., node_modules, pip cache, or Maven .m2) to speed up builds. - Install dependencies and run the full test suite. - Generate a test coverage report and upload it as an artifact. 3. **Linting & Static Analysis Job**: Run [LINTING_TOOL] in parallel with the build job to enforce code quality standards. 4. **Deploy Job**: - This job should only run after both the build and lint jobs succeed. - Only deploy when the event is a push to [BRANCH_NAME] (not on PRs). - Deploy to [DEPLOYMENT_TARGET] (e.g., AWS, Vercel, Docker Hub, GCP). - Use GitHub Secrets for all sensitive credentials โ€” list which secrets need to be configured. 5. **Notifications**: Add a final job that sends a [NOTIFICATION_CHANNEL] notification (e.g., Slack, email, Discord) on both success and failure, including the commit SHA and author. 6. **Security & Best Practices**: Pin all third-party actions to specific SHA commits, use least-privilege permissions with the permissions key, and add concurrency controls to prevent duplicate runs. Provide the complete YAML file with inline comments explaining each section. After the file, include a setup checklist of repository secrets and settings that need to be configured.

๐Ÿ’ก Tips for Better Results

Specify your exact framework and deployment target for a workflow you can use immediately without heavy modifications. List your actual environment names and branch strategy (e.g., main, staging, develop) so the workflow matches your Git flow. Ask for a follow-up prompt to add matrix builds if you need to test across multiple OS or language versions.

๐ŸŽฏ Use Cases

DevOps engineers and developers who want to automate their build, test, and deployment pipeline using GitHub Actions without writing YAML from scratch.

๐Ÿ”— Related Prompts

๐Ÿ’ป Coding beginner

Explain Code Like Im a Beginner

Get any code explained in plain English with line-by-line breakdowns, analogies, and learning suggestions.

๐Ÿ’ป Coding beginner

Debug My Code and Explain the Fix

Get your code debugged with clear explanations of what went wrong and why, plus the corrected version.

๐Ÿ’ป Coding intermediate

Write Unit Tests for My Code

Generate thorough unit tests covering edge cases, error handling, and both positive and negative scenarios.

๐Ÿ’ป Coding intermediate

Convert Code Between Languages

Convert code between any programming languages while maintaining idiomatic patterns and best practices.

๐Ÿ’ป Coding intermediate

Write a REST API Endpoint

Generate production-ready REST API endpoints with validation, error handling, and documentation.

๐Ÿ’ป Coding advanced

Refactor Code for Better Performance

Get your code refactored for better performance with Big O analysis and design pattern suggestions.