|
| 1 | +# Automated Release Notes System |
| 2 | + |
| 3 | +This document explains how the automated release notes generation system works in the create-polyglot project and how contributors can help improve it. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The create-polyglot project uses an automated system to generate comprehensive release notes when new versions are published. This system categorizes changes, generates structured notes, and helps maintain consistency across releases. |
| 8 | + |
| 9 | +## How It Works |
| 10 | + |
| 11 | +### 1. Triggering Release Notes Generation |
| 12 | + |
| 13 | +Release notes are automatically generated in the following scenarios: |
| 14 | + |
| 15 | +- **Automatic**: When a new GitHub release is created |
| 16 | +- **Manual**: By running the "Generate Release Notes" workflow manually |
| 17 | +- **Integrated**: As part of the npm publish workflow |
| 18 | + |
| 19 | +### 2. Categorization Logic |
| 20 | + |
| 21 | +The system analyzes commit messages and categorizes them into the following sections: |
| 22 | + |
| 23 | +#### 🚀 Features Added |
| 24 | +- Commits starting with `feat:` or `feat(scope):` |
| 25 | +- Commits containing words like "add", "implement" |
| 26 | +- New functionality for users |
| 27 | + |
| 28 | +#### 🐛 Bug Fixes |
| 29 | +- Commits starting with `fix:` or `fix(scope):` |
| 30 | +- Commits containing words like "bug", "patch" |
| 31 | +- Fixes that resolve issues for users |
| 32 | + |
| 33 | +#### ⚠️ Breaking Changes |
| 34 | +- Commits starting with `feat!:` or `fix!:` |
| 35 | +- Commits containing the word "breaking" |
| 36 | +- Changes that break backward compatibility |
| 37 | + |
| 38 | +#### 📚 Documentation |
| 39 | +- Commits starting with `docs:` or `docs(scope):` |
| 40 | +- Commits containing "documentation", "readme" |
| 41 | +- Documentation-only changes |
| 42 | + |
| 43 | +#### 🔧 Internal/DevOps |
| 44 | +- Commits starting with `chore:`, `ci:`, `test:`, `refactor:` |
| 45 | +- Internal changes that don't affect users |
| 46 | + |
| 47 | +#### 📦 Dependencies |
| 48 | +- Commits starting with `deps:` |
| 49 | +- Commits containing "dependencies", "package", "bump" |
| 50 | +- Dependency updates |
| 51 | + |
| 52 | +#### 🎉 Other Changes |
| 53 | +- Any commits that don't fit the above categories |
| 54 | + |
| 55 | +### 3. Generated Content |
| 56 | + |
| 57 | +Each release note includes: |
| 58 | + |
| 59 | +- **Categorized change lists** with commit links and authors |
| 60 | +- **Contributors section** with all contributors for the release |
| 61 | +- **Installation instructions** for the new version |
| 62 | +- **Comparison links** to view all changes |
| 63 | +- **Placeholders** for manual additions (upgrade notes, known issues) |
| 64 | + |
| 65 | +## Contributing to Better Release Notes |
| 66 | + |
| 67 | +### For Contributors |
| 68 | + |
| 69 | +#### 1. Use Conventional Commit Messages |
| 70 | + |
| 71 | +Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification: |
| 72 | + |
| 73 | +```bash |
| 74 | +# Good examples |
| 75 | +feat: add Kong API gateway integration |
| 76 | +fix: resolve port collision in service detection |
| 77 | +docs: update README with new CLI commands |
| 78 | +feat!: change default service structure (breaking) |
| 79 | +chore: update dependencies to latest versions |
| 80 | + |
| 81 | +# Less ideal |
| 82 | +Added gateway support |
| 83 | +Fixed bug |
| 84 | +Updated docs |
| 85 | +``` |
| 86 | + |
| 87 | +#### 2. Use Descriptive Commit Messages |
| 88 | + |
| 89 | +- Write commit messages that explain **what** changed from a user's perspective |
| 90 | +- Include the scope when relevant: `feat(cli): add --kong flag` |
| 91 | +- Be specific: instead of "fix bug", write "fix port collision in service detection" |
| 92 | + |
| 93 | +#### 3. Fill Out PR Templates |
| 94 | + |
| 95 | +When creating pull requests: |
| 96 | +- Select the appropriate **Type of Change** |
| 97 | +- Mark whether it's a **User-facing change** or **Internal change only** |
| 98 | +- Provide **Breaking Changes & Migration** details if applicable |
| 99 | +- Write clear descriptions that will help with release notes |
| 100 | + |
| 101 | +#### 4. Tag Breaking Changes Properly |
| 102 | + |
| 103 | +For breaking changes: |
| 104 | +- Use `!` in the commit type: `feat!:` or `fix!:` |
| 105 | +- Include "BREAKING CHANGE:" in the commit body |
| 106 | +- Provide migration steps in the PR description |
| 107 | + |
| 108 | +### For Maintainers |
| 109 | + |
| 110 | +#### 1. Manual Release Notes Enhancement |
| 111 | + |
| 112 | +After automatic generation, maintainers can enhance the release notes by: |
| 113 | + |
| 114 | +- Adding upgrade notes and migration steps |
| 115 | +- Including known issues or caveats |
| 116 | +- Highlighting particularly important changes |
| 117 | +- Adding usage examples for new features |
| 118 | + |
| 119 | +#### 2. Using Manual Workflow Dispatch |
| 120 | + |
| 121 | +To generate release notes for testing or drafts: |
| 122 | + |
| 123 | +1. Go to Actions → "Generate Release Notes" |
| 124 | +2. Click "Run workflow" |
| 125 | +3. Enter the tag name (e.g., `v1.17.0`) |
| 126 | +4. Optionally specify target branch |
| 127 | +5. Review the generated draft release |
| 128 | + |
| 129 | +#### 3. Customizing Templates |
| 130 | + |
| 131 | +The release notes template can be customized by editing: |
| 132 | +- `.github/release-notes-template.md` - Main template structure |
| 133 | +- `.github/workflows/release-notes.yml` - Categorization logic |
| 134 | + |
| 135 | +## System Architecture |
| 136 | + |
| 137 | +### Files Involved |
| 138 | + |
| 139 | +- `.github/release-notes-template.md` - Template for release notes structure |
| 140 | +- `.github/workflows/release-notes.yml` - Main release notes generation workflow |
| 141 | +- `.github/workflows/npm-publish.yml` - Integration with npm publishing |
| 142 | +- `.github/pull_request_template.md` - Enhanced PR template for categorization |
| 143 | + |
| 144 | +### Workflow Process |
| 145 | + |
| 146 | +1. **Trigger**: Release created or manual dispatch |
| 147 | +2. **Analysis**: Analyze commits since last release |
| 148 | +3. **Categorization**: Sort commits by type using regex patterns |
| 149 | +4. **Generation**: Apply categorized content to template |
| 150 | +5. **Publishing**: Update release with generated notes |
| 151 | +6. **Artifacts**: Save generated notes as workflow artifacts |
| 152 | + |
| 153 | +## Customization Options |
| 154 | + |
| 155 | +### Adding New Categories |
| 156 | + |
| 157 | +To add a new category: |
| 158 | + |
| 159 | +1. Update the template in `.github/release-notes-template.md` |
| 160 | +2. Add categorization logic in `.github/workflows/release-notes.yml` |
| 161 | +3. Update the PR template if needed |
| 162 | + |
| 163 | +### Modifying Categorization Rules |
| 164 | + |
| 165 | +Edit the regex patterns in the workflow file: |
| 166 | + |
| 167 | +```bash |
| 168 | +# Example: Adding new patterns for API changes |
| 169 | +if [[ $lower_subject =~ ^api(\(.*\))?: ]] || [[ $lower_subject =~ api.change ]]; then |
| 170 | + api_changes+=("- $subject ([${hash}](https://github.com/${{ github.repository }}/commit/${hash})) by @${author}") |
| 171 | +fi |
| 172 | +``` |
| 173 | + |
| 174 | +### Custom Template Variables |
| 175 | + |
| 176 | +Add new template variables by: |
| 177 | + |
| 178 | +1. Defining them in the template: `{custom_section}` |
| 179 | +2. Generating content in the workflow |
| 180 | +3. Replacing them in the generation step: `NOTES="${NOTES//\{custom_section\}/$CUSTOM_CONTENT}"` |
| 181 | + |
| 182 | +## Best Practices |
| 183 | + |
| 184 | +### For Contributors |
| 185 | + |
| 186 | +- **Be consistent** with commit message formats |
| 187 | +- **Think about users** when writing commit messages |
| 188 | +- **Use scopes** to provide context: `feat(cli):`, `fix(docker):` |
| 189 | +- **Document breaking changes** thoroughly |
| 190 | + |
| 191 | +### For Maintainers |
| 192 | + |
| 193 | +- **Review generated notes** before publishing |
| 194 | +- **Add context** that automated systems can't provide |
| 195 | +- **Update templates** based on feedback and project evolution |
| 196 | +- **Test the system** with manual dispatches before releases |
| 197 | + |
| 198 | +## Troubleshooting |
| 199 | + |
| 200 | +### Common Issues |
| 201 | + |
| 202 | +1. **Missing commits in release notes** |
| 203 | + - Check if commits follow conventional format |
| 204 | + - Verify the previous tag detection logic |
| 205 | + - Ensure commits are not merge commits (they're filtered out) |
| 206 | + |
| 207 | +2. **Incorrect categorization** |
| 208 | + - Review the regex patterns in the workflow |
| 209 | + - Consider updating commit message to be more specific |
| 210 | + - Check for typos in commit prefixes |
| 211 | + |
| 212 | +3. **Workflow failures** |
| 213 | + - Check GitHub Actions logs |
| 214 | + - Verify template syntax |
| 215 | + - Ensure proper permissions are set |
| 216 | + |
| 217 | +### Testing Changes |
| 218 | + |
| 219 | +To test changes to the release notes system: |
| 220 | + |
| 221 | +1. Create a test tag: `git tag v0.0.0-test` |
| 222 | +2. Push the tag: `git push origin v0.0.0-test` |
| 223 | +3. Manually run the workflow with the test tag |
| 224 | +4. Review generated output |
| 225 | +5. Delete test tag when done: `git tag -d v0.0.0-test && git push origin :refs/tags/v0.0.0-test` |
| 226 | + |
| 227 | +## Future Enhancements |
| 228 | + |
| 229 | +Potential improvements to consider: |
| 230 | + |
| 231 | +- **PR-based categorization**: Use PR labels instead of just commit messages |
| 232 | +- **Automated breaking change detection**: Analyze code changes for potential breaking changes |
| 233 | +- **Integration with issue tracking**: Link resolved issues in release notes |
| 234 | +- **Multi-language support**: Generate release notes in multiple languages |
| 235 | +- **Enhanced templates**: More sophisticated templating with conditionals |
| 236 | + |
| 237 | +## Support |
| 238 | + |
| 239 | +If you encounter issues with the automated release notes system: |
| 240 | + |
| 241 | +1. Check the [workflow runs](../../actions/workflows/release-notes.yml) for error details |
| 242 | +2. Review this documentation for best practices |
| 243 | +3. Open an issue with the `documentation` or `ci` label |
| 244 | +4. Contact maintainers in the repository discussions |
0 commit comments