-
Notifications
You must be signed in to change notification settings - Fork 45
/
new_release.sh
executable file
·79 lines (66 loc) · 2.8 KB
/
new_release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
## Prepare files for a new release.
## This script automate this process:
## 1. Update these files with new version and new date:
## - meson.build
## - data/usr/share/gnome/help/diffuse/*/diffuse.xml
## - data/usr/share/omf/diffuse/diffuse-*.omf
## - utils/book2manual.xsl
## - windows-installer/build.py
## - windows-installer/diffuse.iss
## - windows-installer/diffuse.new.iss
## 2. Update CHANGELOG.md
## - Add new line under `## Unreleased` following this syntax: `## x.y.z - YYYY-MM-DD`
## 3. Update AppData release notes in data/io.github.mightycreak.Diffuse.appdata.xml.in:
## - Create a new `<release>` tag under `<releases>`, fill the `version` and `date` attributes
## - Create a new `<description>` tag under the new `<release>` tag
## - Create a new `<p>` tag under the new `<description>` tag
set -e
if [ "$#" -ne "1" ]; then
echo "Usage: $0 NEW_VERSION"
exit 1
fi
NEW_VERSION=$1
DATE_FULL=$(date +%F)
DATE_YEAR=$(date +%Y)
echo "Changing files for new version $NEW_VERSION..."
# meson.build
sed -i -E "s/\bversion: '.+?',/version: '$NEW_VERSION',/" \
meson.build
# GNOME help (.xml and .omf)
sed -i -E "s#<!ENTITY app-version \".+?\">#<!ENTITY app-version \"$NEW_VERSION\">#" \
data/usr/share/gnome/help/diffuse/*/diffuse.xml
sed -i -E "s#<!ENTITY app-year \"2006-\d+\">#<!ENTITY app-year \"2006-$DATE_YEAR\">#" \
data/usr/share/gnome/help/diffuse/*/diffuse.xml
sed -i -E "s#<!ENTITY manual-year \"2009-\d+\">#<!ENTITY manual-year \"2009-$DATE_YEAR\">#" \
data/usr/share/gnome/help/diffuse/*/diffuse.xml
sed -i -E "s#<version identifier=\".+?\" date=\".+?\"/>#<version identifier=\"$NEW_VERSION\" date=\"$DATE_FULL\"/>#" \
data/usr/share/omf/diffuse/diffuse-*.omf
sed -i -E "s#<date>.+?</date>#<date>$DATE_FULL</date>#" \
data/usr/share/omf/diffuse/diffuse-*.omf
# book2manual.xsl
sed -i -E "s#<!ENTITY app-version \".+?\">#<!ENTITY app-version \"$NEW_VERSION\">#" \
utils/book2manual.xsl
sed -i -E "s#<!ENTITY date \".+?\">#<!ENTITY date \"$DATE_FULL\">#" \
utils/book2manual.xsl
# Windows installer (unmaintaned)
sed -i -E "s/VERSION = '.+?'/VERSION = '$NEW_VERSION'/" \
windows-installer/build.py
sed -i -E "s/AppVerName=Diffuse .+?/AppVerName=Diffuse $NEW_VERSION/" \
windows-installer/diffuse.iss
sed -i -E "s/#define MyAppVersion \".+?\"/#define MyAppVersion \"$NEW_VERSION\"/" \
windows-installer/diffuse.iss
# AppData
new_release=" <release version=\"$NEW_VERSION\" date=\"$DATE_FULL\">
<description>
<p></p>
</description>
</release>"
echo "$new_release" | sed -i "/<releases>/r /dev/stdin" \
data/io.github.mightycreak.Diffuse.appdata.xml.in
# CHANGELOG.md
new_changelog="
## $NEW_VERSION - $DATE_FULL"
echo "$new_changelog" | sed -i "/^## Unreleased$/r /dev/stdin" \
CHANGELOG.md
echo "Changes done."