Skip to content

Commit be445d3

Browse files
committed
ci: 修复 release body 提取,使用 Python 解析 changelog
1 parent 1eeb128 commit be445d3

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,34 @@ jobs:
4141
echo "ZIP_FILE=$ZIP_FILE"
4242
echo "ZIP_FILE=$ZIP_FILE" >> $GITHUB_OUTPUT
4343
44+
- name: Extract changelog for version
45+
id: changelog
46+
run: |
47+
VERSION=${{ steps.version.outputs.VERSION }}
48+
python3 -c "
49+
import re
50+
with open('includes/pluginChanges.html', 'r', encoding='utf-8') as f:
51+
content = f.read()
52+
pattern = rf'<h3>{re.escape(VERSION)}</h3>(.*?)</ul>'
53+
match = re.search(pattern, content, re.DOTALL)
54+
if match:
55+
section = match.group(1)
56+
items = re.findall(r'<li>(.*?)</li>', section, re.DOTALL)
57+
for item in items:
58+
text = re.sub(r'<[^>]+>', '', item).strip()
59+
if text:
60+
print(f'- {text}')
61+
else:
62+
print('No changelog found')
63+
" >> $GITHUB_OUTPUT
64+
4465
- name: Create Release
4566
if: steps.artifact.outputs.ZIP_FILE != ''
4667
uses: softprops/action-gh-release@v2
4768
with:
4869
tag_name: ${{ github.ref_name }}
4970
name: Release ${{ steps.version.outputs.VERSION }}
50-
body: "See pluginChanges.html for version details."
71+
body: ${{ steps.changelog.outputs }}
5172
draft: false
5273
prerelease: false
5374
generate_release_notes: false

0 commit comments

Comments
 (0)