Skip to content

Commit ceabe9f

Browse files
fix(flathub): improve changelog generation (#464)
1 parent 6efdecb commit ceabe9f

1 file changed

Lines changed: 2 additions & 21 deletions

File tree

.github/workflows/update-flathub-repo.yml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -133,30 +133,11 @@ jobs:
133133
xml_file="flathub/${{ env.FLATHUB_PKG }}/${{ env.FLATHUB_PKG }}.metainfo.xml"
134134
135135
# Extract release information
136-
version="${{ github.event.release.tag_name }}" && version="${version#v}"
137-
date="${{ github.event.release.published_at }}" && date="${date%%T*}"
138136
changelog="${{ github.event.release.body }}" && changelog="${changelog//&/&}" && \
139137
changelog="${changelog//</&lt;}" && changelog="${changelog//>/&gt;}"
140138
141-
# Store the old release information into a temp file to be used for precise replacement
142-
tmpfile=$(mktemp)
143-
144-
# Match the existing <release> block, replace it with the new data
145-
awk -v version="$version" -v date="$date" -v changelog="$changelog" '
146-
BEGIN { replaced = 0 }
147-
/<release version=.*>/ {
148-
if (!replaced) {
149-
print " <release version=\"" version "\" date=\"" date "\">"
150-
print " <description><p>" changelog "</p></description>"
151-
print " </release>"
152-
replaced = 1
153-
}
154-
}
155-
!/<release version=.*>/ && !/<\/release>/ { print $0 }
156-
' "$xml_file" > "$tmpfile"
157-
158-
# Move the updated file back to the original location
159-
mv "$tmpfile" "$xml_file"
139+
# Replace changelog placeholder with actual changelog
140+
sed -i "s|<!-- changelog -->|$changelog|g" "$xml_file"
160141
161142
- name: Update submodule
162143
if: >-

0 commit comments

Comments
 (0)