- Each workflow should have a unique name and filename.
- Name the main workflows as
workflow-filename.yml - Name the reusable workflows as
_reusable-workflow.yml(with_prefix)
- Name the main workflows as
- A workflow’s name should not be changed once it has been committed to the repository, as this may cause history mismatches and unexpected errors. Therefore, it is recommended to consider changes carefully before modifying existing workflows.
.github/workflows: All runnable workflows must be placed in this directory, as required by the official GitHub Actions documentation. Otherwise, they may not execute correctly..github/scripts: Place reusable or lengthy bash scripts in this directory so they can be referenced and reused in workflows.
- Changes on
featurebranch: Run unit tests, linting, security check, etc - PR on
developbranch (for integration/staging):- Unit + Integration tests (API, DB, UI, etc)
- Build and push staging images
- Deploy to staging environment and test (optional)
- PR on
mainbranch (for production): Final build verification - Completed merge on
mainbranch (for production):- Build and push production-ready images with version tags
- Deploy to production environment
- Official documentation: GitHub Actions Docs - How To
- Advanced customization: Mert Mengü - Guide to GitHub Actions for Advanced CI/CD Workflows
- GitHub Actions with Spring Boot: Pudding Entertainment - GitHub Actions: Spring Boot Application Build and Deployment
- Different branching strategies, including using develop and main branch: Devtron - Branching Strategy for CI/CD
- Run tests on feature and master branch: TeamCity - Branching Strategy for CI/CD