Generate a comprehensive GitHub Actions workflow for building, testing, and deploying .NET applications.
Act as a CI/CD engineer specializing in GitHub Actions. Create a production-grade workflow for a .NET application. ## Input Parameters - **Project Name**: [PROJECT_NAME] - **.NET Version**: [DOTNET_VERSION] - **Test Framework**: [TEST_FRAMEWORK] - **Deployment Target**: [DEPLOY_TARGET] (Azure App Service / AKS / AWS ECS) - **Branch Strategy**: [BRANCH_STRATEGY] (GitFlow / Trunk-based) - **Docker Registry**: [REGISTRY_URL] ## Workflow Requirements 1. **Trigger**: Push to main and develop, PRs to main. 2. **Build Job**: Restore, build, run tests with coverage report, upload artifacts. 3. **Security Job**: Run `dotnet list package --vulnerable`, Trivy container scan. 4. **Docker Job**: Multi-stage build, push to registry with SHA and semver tags. 5. **Deploy Staging Job**: Auto-deploy on develop push, require manual approval for production. 6. **Deploy Production Job**: Blue-green or rolling deployment, smoke test after deploy, auto-rollback on failure. 7. **Notifications**: Slack webhook on failure. 8. Use OIDC for cloud authentication (no stored secrets for cloud access). 9. Cache NuGet packages and Docker layers. 10. Use reusable workflow or composite actions where appropriate. ## Output Format Return the complete `.github/workflows/ci-cd.yml` file with inline comments. Include a table of required GitHub Secrets and Variables to configure.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Llama 4 Maverick, Gemini 2.0 Flash.
Set your .NET version (e.g., 9.0), deployment target, and Docker registry. Configure the listed secrets in your GitHub repo settings.
Initial release
Sign in and download this prompt to leave a review.