Skip to content

Commit b95e32e

Browse files
committed
Update update-version
1 parent 7de6c6b commit b95e32e

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

scripts/update-version

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,24 @@ if [[ -f $APPDATA_FILE ]]; then
3232
sed -i -E "s/(<release version=\")[^\"]*(\" date=\")[^\"]*(\")/\1${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}\2${DATE_ISO}\3/" "$APPDATA_FILE" || exit 1
3333
else
3434
echo "Warning: ${APPDATA_FILE} does not exist, skipping."
35+
fi
36+
37+
CHANGELOG="CHANGELOG"
38+
if [[ -f $CHANGELOG ]]; then
39+
echo "Updating ${CHANGELOG} .."
40+
RFC_DATE=$(./scripts/rfc2822Time)
41+
VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
42+
43+
# Replace first x.y.z with version
44+
sed -i "0,/x.y.z/s/x.y.z/$VERSION/" "$CHANGELOG" || exit 1
45+
46+
# Replace first "Release date:" with "Release date:\n\n$RFC_DATE"
47+
sed -i "0,/Release date:/s/Release date:/Release date:\n\n$RFC_DATE/" "$CHANGELOG" || exit 1
48+
49+
# Prepend the new template
50+
printf "x.y.z\n=====\n\nRelease date:\n\nNew features:\n\nBug fixes:\n\nOther:\n\n" > "$CHANGELOG.new"
51+
cat "$CHANGELOG" >> "$CHANGELOG.new"
52+
mv "$CHANGELOG.new" "$CHANGELOG"
53+
else
54+
echo "Warning: ${CHANGELOG} does not exist, skipping."
3555
fi

0 commit comments

Comments
 (0)