This document outlines the release management strategy for the repository. It serves as a comprehensive guide to ensure a clear and standardized approach for the team and maintainers.
- Release Overview
- Release Strategy
- Versioning Strategy
- Version And Dependencies Management
- Release Workflow
- Git Workflow
- Pipelines
The release management process is essential for maintaining a stable and reliable codebase. It involves several key steps to ensure that new features and bug fixes are properly planned, developed, tested, and released for a new version. The process includes:
- Planning: Define the roadmap and prioritize features and bug fixes for the next release.
- Development: Implement the planned features and fixes in
feature/*
branches, which are then merged into thenext
branch. - Testing: Run unit, integration, and end-to-end tests to ensure the code is stable and meets quality standards.
- Documentation: Update relevant documentation, including API docs, user guides, and the changelog.
- Release Preparation: Create a
release/*
branch from thenext
branch, finalize release-specific changes, and update version numbers. - Release: Merge the
release/*
branch into themain
branch, tag the release. - Post-Release: Merge the
main
branch back into thenext
branch to synchronize changes and notify stakeholders about the release.
This structured approach ensures that each release is well-documented, tested, and aligned with the versioning strategy, providing a clear and standardized process for the team and maintainers.
The release strategy will apply the release batching style, where multiple features and bug fixes are bundled together and released at once. This approach helps to reduce the overhead of managing multiple releases and ensures that the codebase is stable before each release. The maintainers will follow a structured release process to ensure that each release is well-documented, tested, and aligned with the versioning strategy.
- The team/maintainers need to define the roadmap and prioritize the features.
- Based on the roadmap, the team/maintainers will plan the features and bug fixes to be included in the next release.
We follow Semantic Versioning (SemVer) for our version strategy, which uses the format MAJOR.MINOR.PATCH:
- MAJOR version increments when making incompatible changes.
- MINOR version increments when adding functionality in a backward-compatible manner.
- PATCH version increments when making backward-compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format. Reference link Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.
When the patch version of the API is incremented, the patch version of the repository must also be incremented. This reflects backward-compatible fixes or updates that do not alter the API's core functionality.
When the minor version of the API is incremented, the minor version of the repository must also be incremented. Releases with non-breaking additions or enhancements must also update the API Swagger documentation to reflect the changes. Ensure that the repository and API documentation updates are released together to maintain alignment.
When the major version of the API is incremented, the major version of the repository must also be incremented. Breaking changes in the API require corresponding updates to the API Swagger documentation. Repository updates and API documentation updates must be released simultaneously to prevent inconsistencies.
- Maintain consistency between the API version and repository versioning to avoid confusion.
- Always include updated Swagger or OpenAPI documentation with every release, ensuring developers have accurate information.
- Testing and validation are mandatory for every version increment to guarantee compatibility and reliability.
MAJOR version will be changed when the code version is changed.
MINOR version will be changed when the documentation is updated. In some cases, the documentation is not updated, but the code is updated. For example, when a new feature like management of a new type of resource is added, the documentation is not updated, but the code is updated.
PATCH version will be changed when the documentation is updated. It does not mean the code version is updated.
The version.json file serves as a central metadata file to define the versioning and dependencies of a service. It ensures compatibility checks can be automated in CI/CD pipelines and provides clear documentation for integrators about which service versions work together.
// version.json
{
"version": "1.0.0",
"apiVersion": "1.0.0",
"docVersion": "1.0.0",
"dependencies": {
// Example dependency service
"dependency-service": {
"repoUrl": "https://github.com/repo/dependency-service.git",
"versions": ["1.0.0", "1.0.1", "1.0.2"]
}
}
}
- version: The version of the current service. Must align with the Git tag.
- apiVersion: The API version exposed by the service, the field is optional.
- docVersion: The version of the documentation.
- dependencies: A list of dependent services with their repositories and compatible version list, the field is optional.
- repoUrl: URL of the repository for the dependent service.
- versions: Specifies compatible versions.
1. Pre-Release Steps
- Verify all feature branches have been merged into the next branch. The merged features must include all relevant unit tests, integration tests, end-to-end tests, and comprehensive documentation.
- Create a
release/*
branch from the next branch.- Special Case: For cherry-picking specific commits, create the branch from the last release commit on
next
and cherry-pick the required commits fromnext
.
- Special Case: For cherry-picking specific commits, create the branch from the last release commit on
- Update version numbers in package.json and version.json as per Versioning Strategy.
- Run tests (unit, integration, and end-to-end) and ensure they all pass.
- Update documentation (e.g., Swagger, README, or user guides).
- Generate the documentation for the new version using the release script:
# Run the release script yarn release:doc
- Merge the changelog PR automatically generated by the changelog pipeline.
2. Release Steps
- Create a PR for the
release/*
branch to the main branch. - Get approval from the team.
- The PR must pass all automated tests and have no conflicts.
- The PR must include the migration guide if there are any breaking changes.
- Merge the
release/*
branch into main. - Automatically tag will be created for the release by release pipeline.
- Automatically build the docker image and push it to the registry by the package pipeline.
3. Post-Release Steps
- Merge the main branch into the next branch to synchronize changes.
- Notify relevant stakeholders about the release.
4. Hotfix Workflow For critical bugs, follow the Hotfix Release process.
- Create a
hotfix/*
branch from the main branch. - Make the necessary changes and update the version number.
- Create a PR for the
hotfix/*
branch to the main branch. - Get approval from the team.
- The PR description must include the acceptance criteria checklist from the issue ticket.
- The reviewer must ensure that the acceptance criteria are met before approving the PR.
- The PR must pass all automated tests and have no conflicts.
- Merge the PR to the main branch.
- Merge the main branch into the next branch.
- All feature development occurs in
feature/*
branches branched from thenext
branch. - Features are merged back into the
next
branch upon completion and successful review.
- Create a
release/*
branch from thenext
branch to prepare for a new version.
- In some special cases, the release wants to cherry-pick some features from the
next
branch to therelease/*
branch. So, therelease/*
branch needs to be created from the commit that is the previous release merged commit frommain
branch tonext
branch, and then cherry-pick the features from thenext
branch to therelease/*
branch.
- Use this branch to finalize release-specific changes such as version bumping and documentation updates.
- Merge the
release/*
branch into themain
branch to release. - Tag the merge commit on
main
with the release version (e.g.,1.1.0
). - Merge the
main
branch back into thenext
branch to ensure thenext
branch reflects the latest state ofmain
.
- In the event of a critical issue, create a
hotfix/*
branch from themain
branch. - Make and commit the necessary changes.
- Merge the
hotfix/*
branch into themain
branch and tag the commit (e.g.,1.1.1
). - Merge the
main
branch back into thenext
branch to keep both branches synchronized.
gitGraph
commit id: "Start" tag: "v1.0.0"
branch next
commit id: "Next Init"
branch feature/login
commit id: "feat: login"
checkout next
merge feature/login
branch feature/profile
commit id: "feat: profile"
checkout next
merge feature/profile
branch release/1.1.0
commit id: "Prepare Release 1.1.0"
checkout main
merge release/1.1.0 tag: "1.1.0"
checkout next
merge main
branch feature/account
commit id: "feat: account"
checkout next
merge feature/account
checkout main
branch hotfix/1.1.1
commit id: "fix: bug fix"
checkout main
merge hotfix/1.1.1 tag: "1.1.1"
checkout next
merge main
commit id: "Ready for next development"
The changelog pipeline automatically generates a changelog based on the commit messages on the release/*
branch or the hotfix/*
branch.
The changelog generation is initiated by the create-changelog
job in the pipeline.
flowchart TD
A[Start] --> B{Trigger Event}
B -->|Push to release/* or hotfix/*| C[check-skip Job]
B -->|Manual Trigger| C
C --> D[Checkout Code]
D --> E[Check Commit Message for Release PR]
E -->|Skip| F[End]
E -->|Do Not Skip| G[create-changelog Job]
G --> H[Checkout Code]
H --> I[Get Version from version.json]
I -->|Error| F
I --> J[Set Release Version for Changelog]
J --> K[Create Release Changelog]
K --> L[End]
The release pipeline will automatically tag the release version when the release/*
branch or hotfix/*
is merged into the main
branch. The release pipeline will run the unit test and build the application to ensure the code is stable before releasing.
The release is initiated by the release
job in the pipeline.
flowchart TD
A[Start] --> B{Trigger Event}
B -->|Push to main| C[test_and_build Job]
B -->|Manual Trigger| C
C --> D[Checkout Repository]
D --> E[Install pnpm]
E --> F[Install Node.js]
F --> G[Install Dependencies]
G --> H[Build Application]
H --> I[Run Tests]
I --> J[Generate Coverage Report]
C --> K[build_docs Job]
K --> L[Checkout Repository]
L --> M[Setup Node.js]
M --> N[Install Documentation Dependencies]
N --> O[Build Documentation Website]
C --> P[release Job]
K --> P
P --> Q[Checkout Code]
Q --> R[Get Version from version.json]
R -->|Error| Z[End]
R --> S[Create Tag in Repository]
S --> T[Push Tag to Repository]
T --> U[Create GitHub Release]
U --> V[End]
The package pipeline will automatically build the docker image and push it to the registry when existing the new tag in the repository.
The package pipeline is initiated by the package
job in the pipeline.
flowchart TD
A[Start] --> B{Trigger Event}
B -->|Push with valid tag| C[build Job]
B -->|Manual Trigger| C
C --> D[Checkout Repository]
D --> E[Setup Node.js]
E --> F[Generate Docker Metadata]
F --> G[Set up Docker Buildx]
G --> H[Login to GitHub Container Registry]
H --> I[Push Docker Release]
I --> J[End]