|
| 1 | +# Development Version and Branch Handling |
| 2 | + |
| 3 | +This document describes the GitFlow-based branching strategy, version numbering policy, and CI/CD pipeline for the Java Embedded Compiler project. |
| 4 | + |
| 5 | +## Branches |
| 6 | + |
| 7 | +The project uses a [GitFlow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) branching model. Each branch type serves a specific purpose in the release lifecycle: |
| 8 | + |
| 9 | +| Branch Pattern | Base | Purpose | |
| 10 | +|----------------|------|---------| |
| 11 | +| `develop` | — | Main development branch. Contains the latest sources for the current active version. | |
| 12 | +| `feature/JNG-NUMBER_summary` | `develop` | New features for the next release. | |
| 13 | +| `release/X.Y.Z` | `develop` | Stabilization branch for a specific release. The `release/` prefix is reserved for CI. | |
| 14 | +| `bugfix/JNG-NUMBER_summary` | release branch | Bug fixes applied during release testing. Must also be applied to newer release and develop branches. | |
| 15 | +| `support/JNG-NUMBER_summary` | release branch | Minor changes to a previous release; merged back to the release branch on update. | |
| 16 | +| `hotfix/JNG-NUMBER_summary` | `master` | Critical fixes applied to both release and master branches. | |
| 17 | +| `master` | — | Latest released (stable) sources of the active version. | |
| 18 | + |
| 19 | +### Branch Flow Diagram |
| 20 | + |
| 21 | +```mermaid |
| 22 | +gitGraph |
| 23 | + commit id: "init" |
| 24 | + branch develop order: 1 |
| 25 | + checkout develop |
| 26 | + commit id: "dev-1" |
| 27 | + branch feature/JNG-1 order: 2 |
| 28 | + commit id: "feat-1" |
| 29 | + commit id: "feat-2" |
| 30 | + checkout develop |
| 31 | + merge feature/JNG-1 id: "merge-feat-1" |
| 32 | + branch feature/JNG-3 order: 3 |
| 33 | + commit id: "feat-3" |
| 34 | + checkout develop |
| 35 | + merge feature/JNG-3 id: "merge-feat-3" |
| 36 | + branch release/1.0-beta1 order: 4 |
| 37 | + commit id: "rc-1" |
| 38 | + branch bugfix/JNG-4 order: 5 |
| 39 | + commit id: "fix-1" |
| 40 | + checkout release/1.0-beta1 |
| 41 | + merge bugfix/JNG-4 id: "merge-fix" |
| 42 | + checkout develop |
| 43 | + merge release/1.0-beta1 id: "merge-release" |
| 44 | + checkout master |
| 45 | + merge release/1.0-beta1 id: "release-1.0" |
| 46 | +``` |
| 47 | + |
| 48 | +## Version Numbers |
| 49 | + |
| 50 | +Versions follow semantic versioning with these rules: |
| 51 | + |
| 52 | +| Event | Version Change | |
| 53 | +|-------|---------------| |
| 54 | +| Starting a feature branch | No change — inherits from `develop` | |
| 55 | +| Starting a release branch | 2nd number on `develop` is incremented | |
| 56 | +| Bugfix branch (on release) | No change — fixes are applied before release | |
| 57 | +| Support branch | 3rd number is incremented | |
| 58 | +| Hotfix branch | 4th number is incremented | |
| 59 | + |
| 60 | +### Qualified Versions |
| 61 | + |
| 62 | +For non-release branches, the CI appends a qualifier to the version: |
| 63 | + |
| 64 | +``` |
| 65 | +<major>.<minor>.<qualifier>.<date>_<commitId>_<branchName> |
| 66 | +``` |
| 67 | + |
| 68 | +For release branches (`master`, `release/*`), the version is used as-is from `pom.xml` (without `-SNAPSHOT`). |
| 69 | + |
| 70 | +## GitHub Actions Workflows |
| 71 | + |
| 72 | +The CI/CD pipeline consists of several interconnected GitHub Actions workflows: |
| 73 | + |
| 74 | +### build.yml — Primary Build Pipeline |
| 75 | + |
| 76 | +```mermaid |
| 77 | +flowchart TD |
| 78 | + Trigger["Push to develop<br/>or PR to develop/master/release/*"] |
| 79 | + Trigger --> BranchCheck{Branch type?} |
| 80 | + BranchCheck -->|"master, release/*"| CleanVersion["Version from pom.xml<br/>(no qualifier)"] |
| 81 | + BranchCheck -->|"develop, increment/*"| QualifiedVersion["Version with<br/>date_commitId_branch qualifier"] |
| 82 | + CleanVersion --> Build["Maven build & test"] |
| 83 | + QualifiedVersion --> Build |
| 84 | + Build --> DeployNexus["Deploy to Judong Nexus"] |
| 85 | + DeployNexus --> Tag["Create git tag<br/>v<version>"] |
| 86 | + Tag --> ReleaseBranch{Branch?} |
| 87 | + ReleaseBranch -->|"increment/*, release/*"| MergePRTag["Create merge-pr/<version> tag"] |
| 88 | + MergePRTag --> TriggerMerge["Triggers merge-pr-tagged.yml"] |
| 89 | + ReleaseBranch -->|"develop"| Changelog["Build changelog"] |
| 90 | + Changelog --> GHRelease["Create GitHub pre-release"] |
| 91 | +``` |
| 92 | + |
| 93 | +### merge-pr-tagged.yml — Merge Automation |
| 94 | + |
| 95 | +Triggered when a `merge-pr/*` tag is pushed. Routes merges based on version format: |
| 96 | + |
| 97 | +- **`major.minor.qualifier`** format → merge PR to `master`, triggers `create-release-on-master.yml` |
| 98 | +- **Qualified version** → squash PR to `develop`, triggers `build.yml` |
| 99 | + |
| 100 | +After processing, the `merge-pr/*` tag is deleted. |
| 101 | + |
| 102 | +### create-release-on-master.yml — Release Publication |
| 103 | + |
| 104 | +Triggered by pushes to `master`. Builds a changelog and creates a GitHub release marked as the latest stable release. |
| 105 | + |
| 106 | +### release.yml — Manual Release Trigger |
| 107 | + |
| 108 | +Manually triggered with a version parameter (`auto` or explicit `major.minor.qualifier`): |
| 109 | + |
| 110 | +1. Creates a PR to `master` with the release version |
| 111 | +2. Creates a PR to `develop` with the next (qualifier + 1) version |
| 112 | +3. Both PRs trigger `build.yml` |
| 113 | + |
| 114 | +### Other Workflows |
| 115 | + |
| 116 | +| Workflow | Purpose | |
| 117 | +|----------|---------| |
| 118 | +| `bump-version.yml` | Version bumping automation | |
| 119 | +| `delete-old-draft-releases.yml` | Cleanup stale draft GitHub releases | |
| 120 | +| `build-dependabot.yml` | Separate build validation for Dependabot PRs | |
| 121 | +| `jira-description-to-pr.yml` | Copies JIRA ticket descriptions into PR bodies | |
| 122 | + |
| 123 | +## Development Rules |
| 124 | + |
| 125 | +> **Important:** There is no commit without a ticket number. Every commit and pull request must reference a JIRA ticket in the format `JNG-xxx`. |
| 126 | +
|
| 127 | +Issue tracking is managed in [JIRA](https://blackbelt.atlassian.net/jira/dashboards). |
0 commit comments