Created
December 28, 2025 13:10
-
-
Save jamiefdhurst/5cb0e782d76446ce5771915f314aea13 to your computer and use it in GitHub Desktop.
Update GitHub Releases to include information from CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Extract release notes for each version from CHANGELOG.md and update GitHub releases | |
| CHANGELOG="CHANGELOG.md" | |
| # Function to extract notes for a specific version | |
| extract_notes() { | |
| local version=$1 | |
| local in_section=false | |
| local notes="" | |
| while IFS= read -r line; do | |
| # Check if we've found the version header | |
| if [[ $line =~ ^##[[:space:]]\[$version\] ]]; then | |
| in_section=true | |
| continue | |
| fi | |
| # Check if we've hit the next version header | |
| if [[ $in_section == true ]] && [[ $line =~ ^##[[:space:]]\[ ]]; then | |
| break | |
| fi | |
| # Collect lines if we're in the section | |
| if [[ $in_section == true ]]; then | |
| notes+="$line"$'\n' | |
| fi | |
| done < "$CHANGELOG" | |
| # Trim trailing newlines | |
| echo "$notes" | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | |
| } | |
| # Get all releases | |
| releases=$(gh release list --limit 100 | awk '{print $1}') | |
| # Update each release | |
| for version in $releases; do | |
| echo "Processing version $version..." | |
| notes=$(extract_notes "$version") | |
| if [[ -n "$notes" ]]; then | |
| echo "Updating release $version with changelog notes..." | |
| gh release edit "$version" --notes "$notes" | |
| echo "✓ Updated $version" | |
| else | |
| echo "⚠ No changelog notes found for $version" | |
| fi | |
| echo "" | |
| done | |
| echo "All releases updated!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment