7
7
8
8
jobs :
9
9
tag :
10
- name : New tag
10
+ name : Deploy Plugin Tag
11
11
runs-on : ubuntu-latest
12
+
12
13
steps :
13
14
- uses : actions/checkout@v3
14
15
@@ -35,41 +36,50 @@ jobs:
35
36
- name : Extract Release Notes
36
37
id : release_notes
37
38
run : |
39
+ # Define variables
38
40
changelog_section_start="== Changelog =="
39
41
current_tag="${{ github.ref_name }}"
40
42
readme_file="${{ env.readme_file }}"
41
43
42
- # Extract the version (strip 'refs/tags/' if it exists)
44
+ # Extract version from tag (strip 'refs/tags/' if it exists)
43
45
version=${current_tag#refs/tags/}
44
46
45
- # Read lines from the changelog section
47
+ # Initialize variables
46
48
in_changelog=0
47
- release_notes=""
48
49
capturing_version=0
50
+ release_notes=""
51
+
49
52
while IFS= read -r line; do
50
53
# Start capturing after finding the changelog section
51
54
if [[ "$line" == "$changelog_section_start" ]]; then
52
55
in_changelog=1
53
56
continue
54
57
fi
55
58
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
65
74
fi
66
75
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
69
78
release_notes+="$line\n"
70
79
fi
71
80
done < "$readme_file"
72
81
82
+ # Check if release notes were extracted
73
83
if [[ -z "$release_notes" ]]; then
74
84
echo "::error::Failed to extract release notes for version $version."
75
85
exit 1
79
89
echo "Extracted release notes for version $version:"
80
90
printf "%b" "$release_notes"
81
91
82
- # Set output
92
+ # Set output for release notes
83
93
echo "::set-output name=notes::$(printf "%b" "$release_notes")"
84
94
85
95
- name : Debug Release Notes
0 commit comments