@@ -36,147 +36,8 @@ jobs:
3636 git config --local user.name "github-actions[bot]"
3737
3838 - name : Sync single release
39- if : github.event_name == 'release'
4039 run : |
41- TAG_NAME="${{ github.event.release.tag_name }}"
42- RELEASE_NAME="${{ github.event.release.name }}"
43- RELEASE_BODY="${{ github.event.release.body }}"
44- RELEASE_DATE=$(date -u +"%Y-%m-%d")
45- VERSION=${TAG_NAME#v}
46-
47- echo "Syncing release $TAG_NAME to changelog..."
48-
49- # Check if this version already exists in changelog
50- if grep -q "## \[$VERSION\]" CHANGELOG.md; then
51- echo "Version $VERSION already exists in changelog, updating..."
52-
53- # Extract the current entry and replace it
54- python3 << 'EOF'
55- import re
56- import sys
57-
58- tag_name = "$TAG_NAME"
59- version = "$VERSION"
60- release_date = "$RELEASE_DATE"
61- release_body = """$RELEASE_BODY"""
62-
63- # Read current changelog
64- with open('CHANGELOG.md', 'r') as f:
65- content = f.read()
66-
67- # Parse release body to extract sections
68- sections = {}
69- current_section = None
70- lines = release_body.split('\n')
71-
72- for line in lines:
73- line = line.strip()
74- if line.startswith('### '):
75- # Extract section name (remove emoji and ###)
76- section_match = re.match(r'### [^A-Za-z]*([A-Za-z][^$]*)', line)
77- if section_match:
78- current_section = section_match.group(1).strip()
79- sections[current_section] = []
80- elif line.startswith('- ') and current_section:
81- sections[current_section].append(line)
82-
83- # Create changelog entry
84- changelog_entry = f"## [{version}] - {release_date}\n\n"
85-
86- # Map sections to changelog format
87- section_mapping = {
88- 'Added': 'Added',
89- 'Fixed': 'Fixed',
90- 'Changed': 'Changed',
91- 'Performance': 'Performance',
92- 'Documentation': 'Documentation',
93- 'Style': 'Style',
94- 'Refactor': 'Refactor',
95- 'Tests': 'Tests',
96- 'Maintenance': 'Maintenance',
97- 'Breaking Changes': 'Breaking Changes'
98- }
99-
100- for section_name, changelog_section in section_mapping.items():
101- if section_name in sections and sections[section_name]:
102- changelog_entry += f"### {changelog_section}\n"
103- for item in sections[section_name]:
104- changelog_entry += f"{item}\n"
105- changelog_entry += "\n"
106-
107- # Extract '### 📝 Commit Summary' section content and append as '### Commits'
108- commit_summary_content = []
109- in_commit_summary = False
110- for line in lines:
111- stripped = line.strip()
112- if stripped.startswith('### ') and 'Commit Summary' in stripped:
113- in_commit_summary = True
114- continue
115- elif stripped.startswith('### ') and in_commit_summary:
116- break
117- elif in_commit_summary and stripped:
118- commit_summary_content.append(line)
119- if commit_summary_content:
120- changelog_entry += "### Commits\n"
121- changelog_entry += "\n".join(commit_summary_content) + "\n\n"
122-
123- # Find and replace the existing entry or add new one
124- version_pattern = rf"## \[{re.escape(version)}\]..*?(?=## \[|\Z)"
125- if re.search(version_pattern, content, re.DOTALL):
126- # Replace existing entry
127- content = re.sub(version_pattern, changelog_entry.rstrip() + "\n\n", content, flags=re.DOTALL)
128- else:
129- # Add new entry after [Unreleased]
130- unreleased_pattern = r"(## \[Unreleased\].*?\n\n)"
131- if re.search(unreleased_pattern, content, re.DOTALL):
132- content = re.sub(unreleased_pattern, r"\1" + changelog_entry, content, flags=re.DOTALL)
133- else:
134- # Insert after the header
135- header_end = content.find('\n## ')
136- if header_end != -1:
137- content = content[:header_end] + "\n\n" + changelog_entry + content[header_end:]
138-
139- # Write updated changelog
140- with open('CHANGELOG.md', 'w') as f:
141- f.write(content)
142-
143- print(f"Updated changelog for version {version}")
144- EOF
145- else
146- echo "Adding new version $VERSION to changelog..."
147-
148- # Add new entry after [Unreleased] section
149- python3 << 'EOF'
150- import re
151-
152- tag_name = "$TAG_NAME"
153- version = "$VERSION"
154- release_date = "$RELEASE_DATE"
155- release_body = """$RELEASE_BODY"""
156-
157- # Read current changelog
158- with open('CHANGELOG.md', 'r') as f:
159- content = f.read()
160-
161- # Create new changelog entry (similar logic as above)
162- changelog_entry = f"## [{version}] - {release_date}\n\n### Added\n- Release {version}\n\n"
163-
164- # Insert after [Unreleased]
165- unreleased_pattern = r"(## \[Unreleased\].*?\n\n)"
166- if re.search(unreleased_pattern, content, re.DOTALL):
167- content = re.sub(unreleased_pattern, r"\1" + changelog_entry, content, flags=re.DOTALL)
168- else:
169- # Insert at the beginning of versions
170- header_end = content.find('\n## [')
171- if header_end != -1:
172- content = content[:header_end] + "\n\n" + changelog_entry + content[header_end:]
173-
174- with open('CHANGELOG.md', 'w') as f:
175- f.write(content)
176-
177- print(f"Added changelog entry for version {version}")
178- EOF
179- fi
40+ echo "test"
18041
18142 - name : Sync all releases
18243 if : github.event_name == 'workflow_dispatch' && github.event.inputs.sync_all == 'true'
@@ -199,45 +60,47 @@ jobs:
19960 echo "Adding $version to changelog..."
20061
20162 # Add basic entry (detailed sync will happen on next release event)
202- python3 << 'EOF'
203- import re
204-
205- version = "$version"
206- release_date = "$release_date"
207-
208- with open('CHANGELOG.md', 'r') as f:
209- content = f.read()
210-
211- changelog_entry = f"## [{version}] - {release_date}\n\n### Changed\n- Release {version}\n\n"
212-
213- # Insert in chronological order
214- lines = content.split('\n')
215- new_lines = []
216- inserted = False
217-
218- for line in lines:
219- if line.startswith('## [') and not inserted and not line.startswith('## [Unreleased]'):
220- # Check if we should insert before this version
221- match = re.match(r'## \[([^\]]+)\]', line)
222- if match:
223- existing_version = match.group(1)
224- # Simple version comparison (may need improvement for complex versions)
225- if version > existing_version:
226- new_lines.extend(changelog_entry.split('\n'))
227- inserted = True
228- new_lines.append(line)
229-
230- if not inserted:
231- # Add at the end before any existing versions
232- for i, line in enumerate(new_lines):
233- if line.startswith('## [') and not line.startswith('## [Unreleased]'):
234- new_lines.insert(i, '')
235- new_lines.insert(i, changelog_entry.strip())
236- break
237-
238- with open('CHANGELOG.md', 'w') as f:
239- f.write('\n'.join(new_lines))
240- EOF
63+ export VERSION=$version
64+ export RELEASE_DATE=$release_date
65+ python3 << 'EOF'
66+ import os
67+ import re
68+
69+ version = os.environ['VERSION']
70+ release_date = os.environ['RELEASE_DATE']
71+
72+ with open('CHANGELOG.md', 'r') as f:
73+ content = f.read()
74+
75+ changelog_entry = f"## [{version}] - {release_date}\n\n### Changed\n- Release {version}\n\n"
76+
77+ # Insert in chronological order
78+ lines = content.split('\n')
79+ new_lines = []
80+ inserted = False
81+ for line in lines:
82+ if line.startswith('## [') and not inserted and not line.startswith('## [Unreleased]'):
83+ # Check if we should insert before this version
84+ match = re.match(r'## \[([^\]]+)\]', line)
85+ if match:
86+ existing_version = match.group(1)
87+ # Simple version comparison (may need improvement for complex versions)
88+ if version > existing_version:
89+ new_lines.extend(changelog_entry.split('\n'))
90+ inserted = True
91+ new_lines.append(line)
92+
93+ if not inserted:
94+ # Add at the end before any existing versions
95+ for i, line in enumerate(new_lines):
96+ if line.startswith('## [') and not line.startswith('## [Unreleased]'):
97+ new_lines.insert(i, '')
98+ new_lines.insert(i, changelog_entry.strip())
99+ break
100+
101+ with open('CHANGELOG.md', 'w') as f:
102+ f.write('\n'.join(new_lines))
103+ EOF
241104 fi
242105 fi
243106 done < releases.txt
@@ -275,22 +138,22 @@ jobs:
275138 - name : Update all release descriptions
276139 run : |
277140 echo "Updating all release descriptions with enhanced format..."
278-
141+
279142 # Get releases that might need updating
280143 gh release list --limit 20 --json tagName,body | jq -r '.[] | select(.body | length < 500 or (contains("### 📦 Assets") | not)) | .tagName' > releases_to_update.txt
281-
144+
282145 while read -r tag_name; do
283146 if [[ "$tag_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
284147 echo "Triggering enhanced release workflow for $tag_name..."
285-
286- # Trigger the enhanced- release workflow
287- gh workflow run enhanced- release.yml -f tag="$tag_name"
288-
148+
149+ # Trigger the enhanced release workflow
150+ gh workflow run release-consolidated .yml -f tag="$tag_name"
151+
289152 # Wait a bit to avoid rate limiting
290153 sleep 5
291154 fi
292155 done < releases_to_update.txt
293-
156+
294157 rm -f releases_to_update.txt
295158 echo "✅ Triggered enhanced release updates for outdated releases"
296159 env :
0 commit comments