Updated Branching Strategy¶
Workflow Overview¶
graph TD
A[feat/*] -->|Auto-PR| B(dev)
C[fix/*] -->|Auto-PR| B
B -->|Manual PR| D[main]
D -->|Production| E[ghcr.io/org/repo:version]
D -->|Latest| F[ghcr.io/org/repo:latest]
B -->|Staging| G[ghcr.io/org/repo:version-stg]
B -->|Staging Latest| H[ghcr.io/org/repo:latest-stg]
A -->|Feature| I[ghcr.io/org/repo:commit-sha]
C -->|Fix| I
- Main Branch (
main): - Production-ready code
- Protected - no direct pushes
- Only accepts PRs from
devbranch -
Merge triggers:
- Production image build (ghcr.io/org/repo:version)
- Latest tag update (ghcr.io/org/repo:latest)
- Version tag (semver)
-
Development Branch (
dev): - Staging environment
- Accepts PRs from
feat/*andfix/*branches -
Merge triggers:
- Staging image build (ghcr.io/org/repo:version-stg)
- Auto-PR creation to
main
-
Feature Branches (
feat/*): - Created from
devbranch - Push triggers:
- Auto-PR to
dev - CI tests
- Auto-PR to
-
Naming:
feat/description(e.g.,feat/user-auth) -
Fix Branches (
fix/*): - Created from
devbranch - Push triggers:
- Auto-PR to
dev - CI tests
- Auto-PR to
- Can use
-automergesuffix for critical fixes - Naming:
fix/description(e.g.,fix/login-bug)
Image Tagging Strategy¶
| Branch Type | Image Tag Format | Registry Location |
|---|---|---|
| feat/fix | :commit-sha | ghcr.io/org/repo |
| dev | :version-stg | ghcr.io/org/repo |
| main | :version + :latest | ghcr.io/org/repo |
Implementation Requirements¶
- GitHub Actions:
- Auto-PR creation on push
- Image building/pushing
- Version tagging
-
Status checks
-
Branch Protection:
main: Require PR, status checks, reviewdev: Require PR, status checks-
feat/fix: Require status checks -
Scripts:
- Updated
create-branch.jsto enforce naming -
Pre-push hooks to prevent direct pushes to protected branches
-
Version Management:
- Semantic versioning
- Automated changelog generation
- Release notes
Setup Instructions¶
# Install dependencies
pnpm install
# Setup Git hooks
pre-commit install --hook-type pre-commit --hook-type commit-msg --hook-type pre-push
Best Practices¶
-
Always create branches using the interactive tool:
node scripts/create-branch.js -
Keep branches focused and short-lived
-
Use meaningful, descriptive branch names
-
Regularly sync with upstream dev branch