@@ -37,40 +37,34 @@ jobs:
3737 run : |
3838 changelog_section_start="== Changelog =="
3939 readme_file="$readme_file"
40- plugin_version="master " # Assuming the tag is the version
41-
40+ plugin_version="${{ github.ref_name }} " # Assuming the tag is the version
41+
4242 in_changelog=0
4343 release_notes=""
44-
4544 while IFS= read -r line; do
46- if [[ "$line" == "$changelog_section_start" ]]; then
47- in_changelog=1
48- continue
49- fi
50-
51- # Stop capturing when another section starts
52- if [[ $in_changelog -eq 1 && "$line" =~ ^== ]]; then
53- break
54- fi
55-
56- # Capture non-empty lines within the changelog section
57- if [[ $in_changelog -eq 1 && -n "$line" ]]; then
58- release_notes+="$line\n"
59- fi
45+ if [[ "$line" == "$changelog_section_start" ]]; then
46+ in_changelog=1
47+ continue
48+ fi
49+
50+ if [[ $in_changelog -eq 1 && "$line" =~ ^== ]]; then
51+ break
52+ fi
53+
54+ if [[ $in_changelog -eq 1 && -n "$line" ]]; then
55+ release_notes+="$line\n"
56+ fi
6057 done < "$readme_file"
61-
62- # Ensure release notes were extracted
58+
6359 if [[ -z "$release_notes" ]]; then
64- echo "::error::Failed to extract release notes from the changelog section."
65- exit 1
60+ echo "::error::Failed to extract release notes from the changelog section."
61+ exit 1
6662 fi
67-
68- # Escape special characters for environment variable
69- release_notes_escaped=$(printf "%s" "$release_notes" | sed 's/%/%25/g; s/\n/%0A/g; s/\r/%0D/g')
70-
71- # Set the RELEASE_NOTES environment variable
72- echo "RELEASE_NOTES=$release_notes_escaped" >> $GITHUB_ENV
73-
63+
64+ # Use the <<EOF syntax to handle multi-line environment variables correctly
65+ echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
66+ echo -e "$release_notes" >> $GITHUB_ENV
67+ echo "EOF" >> $GITHUB_ENV
7468 source $GITHUB_ENV # Ensure the environment variable is available for subsequent steps
7569
7670 - name : Create zip file
0 commit comments