@@ -43,38 +43,46 @@ jobs:
4343 plugin_version="${{ github.ref_name }}" # Assuming the tag is the version
4444
4545 in_changelog=0
46+ found_version=0
4647 release_notes=""
4748 while IFS= read -r line; do
48- # Start capturing lines after the changelog header
49+ # Start processing after the changelog header
4950 if [[ "$line" == "$changelog_section_start" ]]; then
5051 in_changelog=1
5152 continue
5253 fi
5354
54- # Stop if another version header is encountered
55- if [[ $in_changelog -eq 1 && "$line" =~ ^=[[:space:]]* ]]; then
56- if [[ "$line" == "= ${plugin_version} ="* ]]; then
57- continue
58- else
59- break
55+ # Skip if not in changelog section
56+ if [[ $in_changelog -eq 0 ]]; then
57+ continue
58+ fi
59+
60+ # Check for the current version header
61+ if [[ "$line" == "= ${plugin_version} =" ]]; then
62+ found_version=1
63+ continue
6064 fi
65+
66+ # Stop when another version header is encountered
67+ if [[ $found_version -eq 1 && "$line" =~ ^=.+=$ ]]; then
68+ break
6169 fi
6270
63- # Append the relevant lines for the latest changelog
64- if [[ $in_changelog -eq 1 && "$line" =~ ^\* ]]; then
71+ # Collect lines starting with '*' if we are in the current version section
72+ if [[ $found_version -eq 1 && "$line" =~ ^\* ]]; then
6573 release_notes+="${line}\n"
6674 fi
6775 done < "$readme_file"
6876
6977 if [[ -z "$release_notes" ]]; then
70- echo "::error::Failed to extract release notes from the changelog section ."
78+ echo "::error::Failed to extract release notes for version ${plugin_version} ."
7179 exit 1
7280 fi
7381
7482 # Write the release notes with actual line breaks
7583 echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
7684 echo -e "$release_notes" >> $GITHUB_ENV
77- echo "EOF" >> $GITHUB_ENV
85+ echo "EOF" >> $GITHUB_ENV
7886
7987
8088 - name : Create zip file
0 commit comments