Interview Prep/CI/CD/GitHub Actions and GitLab CI in Production

How do you restrict which branches can deploy to production in GitHub and GitLab?

BeginnerProductionGitHub Actions and GitLab CI in Production
Answer

GitHub: environment production with "Deployment branches and tags" limited to main and v* tags. GitLab: protected environments with allowed deployers, and the job rules restricted to protected refs. Combine with branch protection so only reviewed code reaches the protected branch, and with protected tags so only release managers can create release tags.

All CI/CD questions Roadmap: GitLab CI/CD

More on GitHub Actions and GitLab CI in Production