We follow a strict Gitflow-inspired workflow to ensure code quality and system stability.
| Branch | Protection Level | Purpose |
|---|---|---|
main |
π Locked | Production. Strictly read-only. Only merge from staging. |
staging |
π Locked | QA. Only merge from develop. |
develop |
π‘οΈ Protected | Integration. Main dev branch. PR required. |
feat/* |
π Open | New features (e.g. feat/refresh-token). |
fix/* |
π Open | Bug fixes (e.g. fix/login-error). |
For main, staging, and develop, the following are enforced:
- Pull Request Required: Direct pushes are blocked.
- Status Checks Must Pass: CI (Lint, Test, Docker Build) must succeed.
- Create a Branch:
git checkout -b feat/my-new-feature - Commit Changes: Follow the Commit Convention below.
- Push:
git push origin feat/my-new-feature - Open PR:
- Features -> target
develop - Hotfixes -> target
main(rare)
- Features -> target
- Review: Wait for CI checks. Address feedback.
- Merge: Squash and merge is preferred to keep history clean.
We follow Conventional Commits to automate releases and changelogs.
Format: <type>(<scope>): <description>
feat: A new feature- Example:
feat(auth): implement refresh token flow
- Example:
fix: A bug fix- Example:
fix(db): resolve connection timeout on heavy load
- Example:
docs: Documentation only changes- Example:
docs: update API Swagger definition
- Example:
chore: Maintenance, config, CI/CD (no product code change)- Example:
chore: upgrade go version to 1.24
- Example:
refactor: Code change that neither fixes a bug nor adds a feature- Example:
refactor: optimize transaction service logic
- Example:
To release to Production:
- Ensure
stagingis merged intomain. - Create and push a semantic version tag:
git checkout main git pull git tag -a v1.1.0 -m "Release v1.1.0: Production Ready" git push origin v1.1.0 - The CI/CD pipeline will detect the tag and trigger the deployment workflow (if manual approval flow is configured).
- CI (Continuous Integration): Runs on every push. Checks Code Quality (golangci-lint), Unit Tests, Security (Trivy/Gosec), and attempts a Docker Build.
- CD (Continuous Deployment): Automatically deploys to the corresponding environment (
Dev,Staging,Prod) when code lands on the protected branch.