@@ -102,6 +102,55 @@ jobs:
102102 echo "found=false" >> $GITHUB_OUTPUT
103103 fi
104104
105+ - name : Collect library release notes
106+ env :
107+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
108+ run : |
109+ prev_tag="${{ steps.prev_tag.outputs.tag }}"
110+
111+ # Get old and new library versions
112+ old_ver=""
113+ if [ -n "$prev_tag" ]; then
114+ old_ver=$(git show "${prev_tag}:custom_components/victron_mqtt/_vendor/__init__.py" 2>/dev/null \
115+ | sed -n 's/.*VICTRON_MQTT_VERSION *= *"\(.*\)".*/\1/p')
116+ fi
117+ new_ver=$(sed -n 's/.*VICTRON_MQTT_VERSION *= *"\(.*\)".*/\1/p' custom_components/victron_mqtt/_vendor/__init__.py)
118+
119+ echo "Old library version: $old_ver"
120+ echo "New library version: $new_ver"
121+
122+ if [ -z "$old_ver" ] || [ "$old_ver" = "$new_ver" ]; then
123+ echo "LIB_NOTES=" >> $GITHUB_ENV
124+ exit 0
125+ fi
126+
127+ # Fetch all library releases between old and new version
128+ lib_notes=""
129+ releases=$(gh release list --repo tomer-w/victron_mqtt --json tagName,isDraft -q '[.[] | select(.isDraft | not)] | .[].tagName')
130+ collecting=false
131+ while IFS= read -r tag; do
132+ ver="${tag#v}"
133+ if [ "$ver" = "$old_ver" ]; then
134+ break
135+ fi
136+ if [ "$ver" = "$new_ver" ]; then
137+ collecting=true
138+ fi
139+ if [ "$collecting" = true ]; then
140+ body=$(gh release view "$tag" --repo tomer-w/victron_mqtt --json body -q .body 2>/dev/null || true)
141+ if [ -n "$body" ]; then
142+ lib_notes="${lib_notes}
143+ ### ${tag}
144+ ${body}
145+ "
146+ fi
147+ fi
148+ done <<< "$releases"
149+
150+ echo "LIB_NOTES<<EOF" >> $GITHUB_ENV
151+ echo "$lib_notes" >> $GITHUB_ENV
152+ echo "EOF" >> $GITHUB_ENV
153+
105154 - uses : release-drafter/release-drafter@v7
106155 env :
107156 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -125,6 +174,7 @@ jobs:
125174 body = os.environ['BODY']
126175 commits = os.environ['COMMITS']
127176 authors = os.environ.get('AUTHORS', '').strip()
177+ lib_notes = os.environ.get('LIB_NOTES', '').strip()
128178
129179 # Remove release-drafter's empty placeholders
130180 body = body.replace('No changes\n', '').replace('No changes', '')
@@ -145,13 +195,20 @@ jobs:
145195 items.append(existing)
146196 items.append(commits)
147197 parts[i + 1] = '\n\n' + '\n'.join(items) + '\n\n'
198+ # Append library changes section after Changes
199+ if lib_notes:
200+ parts[i + 1] += '## Library Changes\n\n' + lib_notes + '\n\n'
148201 elif part.strip() == '## Contributors' and i + 1 < len(parts):
149202 existing = parts[i + 1].strip()
150203 if not existing and authors:
151204 parts[i + 1] = '\n\n' + authors + '\n'
152205
153206 body = ''.join(parts)
154207
208+ # If no Changes section existed, append library changes at the end
209+ if lib_notes and '## Library Changes' not in body:
210+ body = body.rstrip() + '\n\n## Library Changes\n\n' + lib_notes
211+
155212 if '## Contributors' not in body and authors:
156213 body = body.rstrip() + '\n\n## Contributors\n\n' + authors
157214
0 commit comments