mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-15 15:15:51 +01:00
- Add comprehensive test files for release notes creation - Add edge case testing for empty changelogs and comments - Add documentation explaining how the feature works - Verify all functionality works as expected
3.1 KiB
3.1 KiB
Release Notes Creation Documentation
Overview
The release.go script now supports a --create-release-notes flag that extracts changelog content from UNRELEASED_CHANGELOG.md and creates a clean release_notes.md file suitable for GitHub releases.
How It Works
1. Command Usage
go run release.go --create-release-notes [output_path]
output_pathis optional, defaults to../../release_notes.md- The script expects
UNRELEASED_CHANGELOG.mdto be at../../UNRELEASED_CHANGELOG.md(relative to the script location)
2. Extraction Process
The extractChangelogContent() function:
- Reads the UNRELEASED_CHANGELOG.md file
- Filters out:
- The main "# Unreleased Changes" header
- HTML comments (
<!-- ... -->) - Empty sections (sections with no bullet points)
- Everything after the
---separator (example entries)
- Preserves:
- Section headers (## Added, ## Changed, etc.) that have content
- Bullet points with actual text (both
-and*styles) - Proper spacing between sections
3. File Structure Expected
# Unreleased Changes
<!-- Comments are ignored -->
## Added
<!-- Section comments ignored -->
- Actual content preserved
- More content
## Changed
<!-- Empty sections are omitted -->
## Fixed
- Bug fixes included
---
### Example Entries:
Everything after the --- is ignored
4. Output Format
The generated release_notes.md contains only the actual changelog entries:
## Added
- Actual content preserved
- More content
## Fixed
- Bug fixes included
Testing Results
✅ Successful Tests
- Valid Content Extraction: Successfully extracts and formats changelog entries
- Empty Changelog Detection: Properly fails when no content exists
- Comment Filtering: Correctly removes HTML comments
- Mixed Bullet Styles: Handles both
-and*bullet points - Custom Output Path: Supports specifying custom output file location
- Flag Compatibility: Works with
--check-onlyand--extract-changelogflags
Test Commands Run
# Create release notes with default path
go run release.go --create-release-notes
# Create with custom path
go run release.go --create-release-notes /path/to/output.md
# Check if content exists
go run release.go --check-only
# Extract content to stdout
go run release.go --extract-changelog
Integration with GitHub Workflow
The nightly release workflow should:
- Run
go run release.go --create-release-notesbefore the main release task - Use the generated
release_notes.mdfor the GitHub release body - The main release task will clear UNRELEASED_CHANGELOG.md after processing
Error Handling
The script will exit with status 1 if:
- UNRELEASED_CHANGELOG.md doesn't exist
- No actual content is found (only template/comments)
- File write operations fail
Benefits
- Separation of Concerns: Changelog extraction happens before the file is cleared
- Clean Output: No template text or comments in release notes
- Testable: Can be run and tested independently
- Flexible: Supports custom output paths
- Consistent: Same extraction logic used by all flags