|
| 1 | +# Automated Release Management |
| 2 | + |
| 3 | +This document describes the GitHub Actions workflows available for automated release notes generation and changelog management. |
| 4 | + |
| 5 | +## 🚀 Available Workflows |
| 6 | + |
| 7 | +### 1. Basic Release Notes (`release-notes.yml`) |
| 8 | + |
| 9 | +**Triggers:** |
| 10 | +- Push to `main`, `dev`, `develop` |
| 11 | +- Pull requests to `main`, `dev`, `develop` |
| 12 | + |
| 13 | +**Features:** |
| 14 | +- ✅ Automatic CHANGELOG updates |
| 15 | +- ✅ Release notes generation |
| 16 | +- ✅ Smart change detection (only runs if needed) |
| 17 | +- ✅ Direct commits to main branch |
| 18 | +- ✅ Pull requests for other branches |
| 19 | + |
| 20 | +**What it does:** |
| 21 | +- Detects new commits since last CHANGELOG update |
| 22 | +- Updates `CHANGELOG` using `updateCHANGELOG.sh` |
| 23 | +- Generates `RELEASE_NOTES-HEAD.md` from tag `43.0.0` to `HEAD` |
| 24 | +- Commits changes automatically or creates PR |
| 25 | + |
| 26 | +### 2. Advanced Release Management (`advanced-release-management.yml`) |
| 27 | + |
| 28 | +**Triggers:** |
| 29 | +- Push to `main`, `dev` |
| 30 | +- Tag pushes (version tags) |
| 31 | +- Manual dispatch with options |
| 32 | + |
| 33 | +**Advanced Features:** |
| 34 | +- 🏷️ Automatic GitHub releases for tags |
| 35 | +- 🔄 Version range detection |
| 36 | +- ⚙️ Force update option |
| 37 | +- 📊 Detailed job summaries |
| 38 | +- 🎯 Smart tag-based release notes |
| 39 | + |
| 40 | +**Manual Trigger Options:** |
| 41 | +- `force_update`: Force update even if no changes detected |
| 42 | +- `version_tag`: Specific version tag to generate release notes for |
| 43 | + |
| 44 | +### 3. Manual Release Notes Generator (`manual-release-notes.yml`) |
| 45 | + |
| 46 | +**Triggers:** |
| 47 | +- Manual dispatch only |
| 48 | + |
| 49 | +**Full Control Features:** |
| 50 | +- 📝 Custom commit range selection |
| 51 | +- 🎛️ Optional CHANGELOG updates |
| 52 | +- 📋 Artifact generation |
| 53 | +- 🔍 Commit validation |
| 54 | +- 📊 Detailed analysis |
| 55 | + |
| 56 | +**Manual Parameters:** |
| 57 | +- `start_ref`: Start reference (tag, branch, or commit) |
| 58 | +- `end_ref`: End reference (tag, branch, or commit) |
| 59 | +- `update_changelog`: Whether to update CHANGELOG |
| 60 | + |
| 61 | +## 📖 Usage Guide |
| 62 | + |
| 63 | +### Automatic Usage |
| 64 | + |
| 65 | +Most workflows run automatically: |
| 66 | + |
| 67 | +```yaml |
| 68 | +# Triggered on every push to main/dev |
| 69 | +git push origin main |
| 70 | + |
| 71 | +# Triggered on PR creation |
| 72 | +gh pr create --title "New feature" --body "Description" |
| 73 | + |
| 74 | +# Triggered on tag creation |
| 75 | +git tag v1.2.3 |
| 76 | +git push origin v1.2.3 |
| 77 | +``` |
| 78 | + |
| 79 | +### Manual Triggers |
| 80 | + |
| 81 | +#### Quick Force Update |
| 82 | +```bash |
| 83 | +# Via GitHub CLI |
| 84 | +gh workflow run "Advanced Release Management" \ |
| 85 | + --field force_update=true |
| 86 | + |
| 87 | +# Via GitHub Web UI |
| 88 | +# Go to Actions > Advanced Release Management > Run workflow |
| 89 | +# Check "Force update" and click "Run workflow" |
| 90 | +``` |
| 91 | + |
| 92 | +#### Custom Range Release Notes |
| 93 | +```bash |
| 94 | +# Generate release notes for specific range |
| 95 | +gh workflow run "Manual Release Notes Generator" \ |
| 96 | + --field start_ref="v1.2.0" \ |
| 97 | + --field end_ref="v1.3.0" \ |
| 98 | + --field update_changelog=true |
| 99 | + |
| 100 | +# Generate from last 10 commits |
| 101 | +gh workflow run "Manual Release Notes Generator" \ |
| 102 | + --field start_ref="HEAD~10" \ |
| 103 | + --field end_ref="HEAD" \ |
| 104 | + --field update_changelog=false |
| 105 | +``` |
| 106 | + |
| 107 | +## 📁 Generated Files |
| 108 | + |
| 109 | +| File | Description | Generated By | |
| 110 | +|------|-------------|--------------| |
| 111 | +| `CHANGELOG` | Raw git log format | `updateCHANGELOG.sh` | |
| 112 | +| `RELEASE_NOTES-HEAD.md` | Current development notes | All workflows | |
| 113 | +| `RELEASE_NOTES-{tag}.md` | Tagged release notes | Advanced/Manual workflows | |
| 114 | + |
| 115 | +## 🔧 Configuration |
| 116 | + |
| 117 | +### Baseline Configuration |
| 118 | +- **Default Start Tag**: `43.0.0` - All automatic release notes start from this baseline |
| 119 | +- **Range**: Release notes cover `43.0.0` → `HEAD` by default |
| 120 | +- **Customization**: Modify `START_TAG="43.0.0"` in workflow files to change baseline |
| 121 | + |
| 122 | +### Environment Variables |
| 123 | +- `GITHUB_TOKEN`: Automatically provided (no setup needed) |
| 124 | + |
| 125 | +### Permissions Required |
| 126 | +```yaml |
| 127 | +permissions: |
| 128 | + contents: write # For committing changes |
| 129 | + pull-requests: write # For creating PRs |
| 130 | + issues: write # For linking issues (advanced workflow) |
| 131 | +``` |
| 132 | +
|
| 133 | +### Branch Protection |
| 134 | +Workflows respect branch protection rules: |
| 135 | +- **Protected branches**: Creates pull requests |
| 136 | +- **Unprotected branches**: Direct commits |
| 137 | +
|
| 138 | +## 📋 Best Practices |
| 139 | +
|
| 140 | +### For Development |
| 141 | +1. **Let automatic workflows handle routine updates** |
| 142 | + - Push to `dev` branch triggers automatic updates |
| 143 | + - Review generated content in pull requests |
| 144 | + |
| 145 | +2. **Use manual triggers for special cases** |
| 146 | + - Generating historical release notes |
| 147 | + - Creating release notes for specific ranges |
| 148 | + - Force updates when automatic detection fails |
| 149 | + |
| 150 | +### For Releases |
| 151 | +1. **Tag-based releases are automated** |
| 152 | + ```bash |
| 153 | + git tag v1.2.3 |
| 154 | + git push origin v1.2.3 |
| 155 | + # → Automatic GitHub release created |
| 156 | + ``` |
| 157 | + |
| 158 | +2. **Manual release preparation** |
| 159 | + ```bash |
| 160 | + # Generate release notes before tagging |
| 161 | + gh workflow run "Manual Release Notes Generator" \ |
| 162 | + --field start_ref="v1.2.0" \ |
| 163 | + --field end_ref="HEAD" |
| 164 | + ``` |
| 165 | + |
| 166 | +### For Maintenance |
| 167 | +1. **Regular CHANGELOG cleanup** |
| 168 | + - Automatic updates keep CHANGELOG current |
| 169 | + - Manual review recommended for major releases |
| 170 | + |
| 171 | +2. **Historical documentation** |
| 172 | + - Use manual workflow to generate missing release notes |
| 173 | + - Maintain consistent formatting across versions |
| 174 | + |
| 175 | +## 🚨 Troubleshooting |
| 176 | + |
| 177 | +### Common Issues |
| 178 | + |
| 179 | +**Workflow doesn't trigger:** |
| 180 | +- Check branch names match trigger conditions |
| 181 | +- Verify repository permissions |
| 182 | +- Ensure `GITHUB_TOKEN` has necessary permissions |
| 183 | + |
| 184 | +**No changes detected:** |
| 185 | +- Verify commits exist in specified range |
| 186 | +- Check if CHANGELOG is already up to date |
| 187 | +- Use `force_update=true` for manual override |
| 188 | + |
| 189 | +**Linting failures:** |
| 190 | +- Workflows run linting before committing |
| 191 | +- Fix YAML syntax errors in generated files |
| 192 | +- Check `lint-files.sh` output for details |
| 193 | + |
| 194 | +**Permission denied:** |
| 195 | +- Verify workflow has `contents: write` permission |
| 196 | +- Check branch protection settings |
| 197 | +- Ensure GitHub token has necessary scope |
| 198 | + |
| 199 | +### Debug Steps |
| 200 | + |
| 201 | +1. **Check workflow logs:** |
| 202 | + ```bash |
| 203 | + gh run list --workflow="release-notes.yml" |
| 204 | + gh run view [run-id] --log |
| 205 | + ``` |
| 206 | + |
| 207 | +2. **Test locally:** |
| 208 | + ```bash |
| 209 | + # Test changelog update |
| 210 | + ./src/scripts/updateCHANGELOG.sh |
| 211 | + |
| 212 | + # Test release notes generation (same as workflow) |
| 213 | + ./src/scripts/generate-release-notes.sh 43.0.0 HEAD |
| 214 | + |
| 215 | + # Test with recent commits only |
| 216 | + ./src/scripts/generate-release-notes.sh HEAD~5 HEAD |
| 217 | + ``` |
| 218 | + |
| 219 | +3. **Validate references:** |
| 220 | + ```bash |
| 221 | + # Check if ref exists |
| 222 | + git rev-parse --verify HEAD~10 |
| 223 | + |
| 224 | + # Check commit range |
| 225 | + git log --oneline HEAD~10..HEAD |
| 226 | + ``` |
| 227 | + |
| 228 | +## 🔗 Related Documentation |
| 229 | + |
| 230 | +- [`updateCHANGELOG.sh`](../src/scripts/updateCHANGELOG.sh) - CHANGELOG update script |
| 231 | +- [`generate-release-notes.sh`](../src/scripts/generate-release-notes.sh) - Release notes generator |
| 232 | +- [GitHub Actions Documentation](https://docs.github.com/en/actions) |
| 233 | +- [Meza Release Process](https://wiki.freephile.org/wiki/RELEASE_NOTES) |
| 234 | + |
| 235 | +## 📝 Examples |
| 236 | + |
| 237 | +### Typical Workflow |
| 238 | + |
| 239 | +```bash |
| 240 | +# 1. Development work |
| 241 | +git checkout dev |
| 242 | +git commit -m "Add new feature" |
| 243 | +git push origin dev |
| 244 | +# → Automatic CHANGELOG/release notes update via PR |
| 245 | +
|
| 246 | +# 2. Merge to main |
| 247 | +git checkout main |
| 248 | +git merge dev |
| 249 | +git push origin main |
| 250 | +# → Direct commit with updated documentation (43.0.0 → HEAD) |
| 251 | +
|
| 252 | +# 3. Create release |
| 253 | +git tag 43.58.0 |
| 254 | +git push origin 43.58.0 |
| 255 | +# → Automatic GitHub release with release notes |
| 256 | +``` |
| 257 | + |
| 258 | +### Manual Release Notes for Historical Versions |
| 259 | + |
| 260 | +```bash |
| 261 | +# Generate release notes between two tags |
| 262 | +gh workflow run "Manual Release Notes Generator" \ |
| 263 | + --field start_ref="43.0.0" \ |
| 264 | + --field end_ref="43.57.1" \ |
| 265 | + --field update_changelog=false |
| 266 | +
|
| 267 | +# Generate from baseline tag to HEAD (same as automatic workflow) |
| 268 | +gh workflow run "Manual Release Notes Generator" \ |
| 269 | + --field start_ref="43.0.0" \ |
| 270 | + --field end_ref="HEAD" \ |
| 271 | + --field update_changelog=true |
| 272 | +
|
| 273 | +# Generate from first commit to baseline tag (historical) |
| 274 | +gh workflow run "Manual Release Notes Generator" \ |
| 275 | + --field start_ref="$(git rev-list --max-parents=0 HEAD)" \ |
| 276 | + --field end_ref="43.0.0" \ |
| 277 | + --field update_changelog=false |
| 278 | +``` |
0 commit comments