Release Management
GhanaAPI uses automated release workflows to ensure consistent, reliable releases with proper versioning, testing, and documentation. This guide explains how releases work and how to create new releases.
๐ Release Overviewโ
Our release system supports two approaches:
- Automated Version Bump Workflow - Recommended for team environments
- Manual Version Updates - Quick approach for direct releases
Both approaches trigger the same automated release process, ensuring consistency regardless of how the version is updated.
๐ Semantic Versioningโ
GhanaAPI follows Semantic Versioning (SemVer) with the format MAJOR.MINOR.PATCH
:
Version Componentsโ
Component | When to Increment | Example |
---|---|---|
MAJOR | Breaking changes that require user action | 1.0.0 โ 2.0.0 |
MINOR | New features that are backward compatible | 1.0.0 โ 1.1.0 |
PATCH | Bug fixes and minor updates | 1.0.0 โ 1.0.1 |
PRERELEASE | Alpha, beta, or release candidate versions | 1.0.0 โ 1.0.1-alpha.1 |
Version Examplesโ
{
"version": "0.2.1" // Current version
}
Possible Next Versions:
- Patch:
0.2.2
(bug fixes) - Minor:
0.3.0
(new features) - Major:
1.0.0
(breaking changes) - Prerelease:
0.2.2-alpha.1
(testing version)
๐ Release Approachesโ
Approach 1: Automated Version Bump (Recommended)โ
Use the automated workflow for a controlled, reviewable release process.
How It Worksโ
- Trigger Workflow via GitHub UI or CLI
- Select Version Type (patch, minor, major, prerelease)
- Automatic Processing:
- Creates new branch (
version-bump/vX.Y.Z
) - Updates
backend/package.json
- Updates
CHANGELOG.md
- Creates Pull Request
- Creates new branch (
- Review and Merge the PR
- Automatic Release triggers when merged to main
Using GitHub UIโ
- Navigate to repository โ Actions tab
- Select "Version Bump" workflow
- Click "Run workflow" button
- Configure options:
- Version Type: Choose from dropdown
patch
- Bug fixes (0.2.1 โ 0.2.2)minor
- New features (0.2.1 โ 0.3.0)major
- Breaking changes (0.2.1 โ 1.0.0)prerelease
- Alpha/beta (0.2.1 โ 0.2.2-alpha.1)
- Prerelease Identifier (if prerelease selected):
alpha
- Early developmentbeta
- Feature complete, testingrc
- Release candidate
- Version Type: Choose from dropdown
- Click "Run workflow"
Using GitHub CLIโ
# Patch release (bug fixes)
gh workflow run version-bump.yml -f version_type=patch
# Minor release (new features)
gh workflow run version-bump.yml -f version_type=minor
# Major release (breaking changes)
gh workflow run version-bump.yml -f version_type=major
# Alpha prerelease
gh workflow run version-bump.yml -f version_type=prerelease -f prerelease_identifier=alpha
# Beta prerelease
gh workflow run version-bump.yml -f version_type=prerelease -f prerelease_identifier=beta
# Release candidate
gh workflow run version-bump.yml -f version_type=prerelease -f prerelease_identifier=rc
Generated Pull Requestโ
The workflow creates a PR with comprehensive information:
## Version Bump: v0.2.2
**Type:** patch
**Previous Version:** 0.2.1
**New Version:** 0.2.2
### Changes
- โฌ๏ธ Bumped backend version from `0.2.1` to `0.2.2`
- ๐ Updated CHANGELOG.md with version entry
### What happens next?
When this PR is merged to main, it will automatically trigger the release workflow to:
- Create a Git tag `v0.2.2`
- Generate a GitHub release with changelog
- Build and attach backend artifacts
---
_This PR was created automatically by the Version Bump workflow._
_Triggered by: @username_
Approach 2: Manual Version Updatesโ
Direct approach for quick releases or hotfixes.
How It Worksโ
- Edit
backend/package.json
manually - Update version number
- Commit and Push to main branch
- Automatic Release triggers immediately
Manual Processโ
# 1. Update version in package.json
cd backend
npm version patch --no-git-tag-version # or minor, major
# 2. Commit changes
git add package.json
git commit -m "chore: bump version to v0.2.2"
# 3. Push to main (triggers release)
git push origin main
Version Update Commandsโ
# Patch version (0.2.1 โ 0.2.2)
npm version patch --no-git-tag-version
# Minor version (0.2.1 โ 0.3.0)
npm version minor --no-git-tag-version
# Major version (0.2.1 โ 1.0.0)
npm version major --no-git-tag-version
# Prerelease version (0.2.1 โ 0.2.2-alpha.1)
npm version prerelease --preid=alpha --no-git-tag-version
๐ค Automatic Release Processโ
Regardless of the approach used, the same automated release workflow runs when a version change is detected in main
.
Release Workflow Stepsโ
1. Version Change Detectionโ
- Monitors
backend/package.json
on main branch - Compares current version with previous commit
- Only proceeds if version has changed
2. Build and Testโ
# Install dependencies
npm ci
# Run test suite
npm run test
npm run test:e2e
# Build application
npm run build
3. Changelog Generationโ
- Extracts commits since last version
- Formats as markdown release notes
- Includes commit hashes and messages
4. Git Tag Creationโ
# Create and push version tag
git tag -a v0.2.2 -m "Release v0.2.2"
git push origin v0.2.2
5. Build Artifactsโ
- Creates production build
- Packages as compressed archive
- Includes all necessary files
6. GitHub Releaseโ
- Creates GitHub release page
- Attaches build artifacts
- Includes generated changelog
- Marks as prerelease if version contains alpha/beta/rc
Release Artifactsโ
Each release includes:
- Source Code (automatic GitHub archive)
- Backend Build (
backend-build-v0.2.2.tar.gz
) - Release Notes (generated from commits)
- Version Information (backend version, release date)
๐ Release Types and Use Casesโ
When to Use Each Version Typeโ
Patch Releases (0.2.1 โ 0.2.2)โ
Use for:
- ๐ Bug fixes
- ๐ง Security patches
- ๐ Documentation corrections
- ๐จ Code style improvements
Examples:
# Fix API timeout issue
npm version patch --no-git-tag-version
# Security vulnerability patch
gh workflow run version-bump.yml -f version_type=patch
Minor Releases (0.2.1 โ 0.3.0)โ
Use for:
- โจ New features
- ๐ API enhancements
- ๐ Performance improvements
- ๐ ๏ธ New endpoints
Examples:
# Add new address validation endpoint
gh workflow run version-bump.yml -f version_type=minor
# Enhance exchange rate API
npm version minor --no-git-tag-version
Major Releases (0.2.1 โ 1.0.0)โ
Use for:
- ๐ฅ Breaking API changes
- ๐ Major architecture changes
- ๐๏ธ Removing deprecated features
- ๐ Changing data formats
Examples:
# Breaking API changes
gh workflow run version-bump.yml -f version_type=major
# Remove deprecated endpoints
npm version major --no-git-tag-version
Prerelease Versionsโ
Use for:
- ๐งช Testing new features
- ๐ Beta releases
- ๐ง Release candidates
Alpha (early development):
gh workflow run version-bump.yml -f version_type=prerelease -f prerelease_identifier=alpha
# Result: 0.2.1 โ 0.2.2-alpha.1
Beta (feature complete):
gh workflow run version-bump.yml -f version_type=prerelease -f prerelease_identifier=beta
# Result: 0.2.1 โ 0.2.2-beta.1
Release Candidate (final testing):
gh workflow run version-bump.yml -f version_type=prerelease -f prerelease_identifier=rc
# Result: 0.2.1 โ 0.2.2-rc.1
๐ฏ Best Practicesโ
Release Planningโ
- Plan releases around feature completions
- Group related changes into single releases
- Test thoroughly before releasing
- Document breaking changes clearly
Version Selectionโ
- Use patch for urgent fixes
- Use minor for regular feature releases
- Use major sparingly for significant changes
- Use prerelease for testing and feedback
Release Notesโ
- Write clear descriptions of changes
- Include migration guides for breaking changes
- Link to relevant documentation
- Thank contributors
Testing Strategyโ
- Run full test suite before releasing
- Test in staging environment
- Verify API compatibility
- Check documentation accuracy
๐ Changelog Managementโ
Automatic Generationโ
The release workflow automatically generates changelogs from commit messages:
## What's Changed
- feat: add bulk address validation endpoint (a1b2c3d)
- fix: resolve exchange rate timeout issue (d4e5f6g)
- docs: update API documentation examples (g7h8i9j)
**Backend Version:** 0.2.2
**Release Date:** 2024-01-15
Manual Enhancementโ
You can enhance changelogs by:
- Editing release notes after creation
- Adding context and explanations
- Including breaking change warnings
- Adding upgrade instructions
Conventional Commits Benefitsโ
Using conventional commit messages enables:
- Automatic changelog generation
- Semantic version suggestions
- Release note categorization
- Breaking change detection
๐จ Troubleshootingโ
Common Issuesโ
Release Not Triggeringโ
Problem: Version change not detected Solutions:
- Ensure
backend/package.json
version changed - Check that push was to
main
branch - Verify workflow file is present and valid
Build Failuresโ
Problem: Tests or build failing during release Solutions:
- Run tests locally before releasing
- Check for missing dependencies
- Verify environment configuration
Version Conflictsโ
Problem: Version already exists Solutions:
- Check existing tags and releases
- Use correct version increment
- Consider using prerelease versions
Rollback Proceduresโ
Rolling Back a Releaseโ
# 1. Delete the Git tag
git tag -d v0.2.2
git push origin --delete v0.2.2
# 2. Revert version in package.json
git revert <commit-hash>
# 3. Delete GitHub release (manual)
# Go to GitHub Releases and delete manually
Emergency Hotfixโ
# 1. Create hotfix branch from main
git checkout -b hotfix/critical-security-fix
# 2. Make necessary changes
git commit -m "fix: resolve critical security vulnerability"
# 3. Bump patch version
npm version patch --no-git-tag-version
# 4. Merge to main (triggers release)
git checkout main
git merge hotfix/critical-security-fix
git push origin main
๐ Release Metricsโ
Tracking Successโ
Monitor release success through:
- Build Success Rate: Percentage of successful releases
- Test Coverage: Ensure tests pass before release
- Deployment Time: Monitor release workflow duration
- User Feedback: Track issues reported after releases
Release Scheduleโ
Consider establishing a regular release schedule:
- Patch Releases: As needed for bugs
- Minor Releases: Monthly or bi-weekly
- Major Releases: Quarterly or as needed
- Prerelease: Continuous for testing
๐ Additional Resourcesโ
- Semantic Versioning Specification
- Conventional Commits
- GitHub Releases Documentation
- npm version Command
For most changes, use the automated version bump workflow as it provides better visibility, review process, and documentation. Reserve manual updates for urgent hotfixes.
Always use major version increments for breaking changes and provide clear migration documentation in release notes.
If you encounter issues with releases, check the GitHub Actions logs or ask for help in GitHub Discussions.