77
88jobs :
99 tag :
10- name : New tag
10+ name : Deploy Plugin Tag
1111 runs-on : ubuntu-latest
12+
1213 steps :
1314 - uses : actions/checkout@v3
1415
@@ -35,41 +36,50 @@ jobs:
3536 - name : Extract Release Notes
3637 id : release_notes
3738 run : |
39+ # Define variables
3840 changelog_section_start="== Changelog =="
3941 current_tag="${{ github.ref_name }}"
4042 readme_file="${{ env.readme_file }}"
4143
42- # Extract the version (strip 'refs/tags/' if it exists)
44+ # Extract version from tag (strip 'refs/tags/' if it exists)
4345 version=${current_tag#refs/tags/}
4446
45- # Read lines from the changelog section
47+ # Initialize variables
4648 in_changelog=0
47- release_notes=""
4849 capturing_version=0
50+ release_notes=""
51+
4952 while IFS= read -r line; do
5053 # Start capturing after finding the changelog section
5154 if [[ "$line" == "$changelog_section_start" ]]; then
5255 in_changelog=1
5356 continue
5457 fi
5558
56- # Stop capturing if we encounter a new version or the end of the file
57- if [[ $in_changelog -eq 1 && "$line" =~ ^= ]]; then
58- # Check if this is the current version
59- if [[ "$line" == "= $version =" ]]; then
60- capturing_version=1
61- elif [[ $capturing_version -eq 1 ]]; then
62- # Stop if we see the next version
63- break
64- fi
59+ # Skip lines before the changelog section
60+ if [[ $in_changelog -eq 0 ]]; then
61+ continue
62+ fi
63+
64+ # Start capturing if the line matches the current version
65+ if [[ "$line" == "= $version =" ]]; then
66+ capturing_version=1
67+ release_notes+="$line\n"
68+ continue
69+ fi
70+
71+ # Stop capturing when a new version is detected
72+ if [[ $capturing_version -eq 1 && "$line" =~ ^= ]]; then
73+ break
6574 fi
6675
67- # Capture lines only for the current version
68- if [[ $capturing_version -eq 1 && -n "$line" ]]; then
76+ # Add the line to the release notes if we are capturing
77+ if [[ $capturing_version -eq 1 ]]; then
6978 release_notes+="$line\n"
7079 fi
7180 done < "$readme_file"
7281
82+ # Check if release notes were extracted
7383 if [[ -z "$release_notes" ]]; then
7484 echo "::error::Failed to extract release notes for version $version."
7585 exit 1
7989 echo "Extracted release notes for version $version:"
8090 printf "%b" "$release_notes"
8191
82- # Set output
92+ # Set output for release notes
8393 echo "::set-output name=notes::$(printf "%b" "$release_notes")"
8494
8595 - name : Debug Release Notes
0 commit comments