Skip to content

Commit b158b55

Browse files
authored
Merge pull request #208 from MightyCreak/simplify-new-release
Add `new_release.sh` script to prepare files for new releases
2 parents be433eb + 93f0527 commit b158b55

File tree

2 files changed

+104
-31
lines changed

2 files changed

+104
-31
lines changed

docs/developers/release-process.md

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,40 @@ few manual steps.
55

66
## Prepare the PR for the new release
77

8-
1. Find the next version, using semantic versioning, depending on the changes
9-
in the changelog
10-
2. Find and replace the old version with the new version in some files:
11-
- meson.build
12-
- data/usr/share/gnome/help/diffuse/*/diffuse.xml
13-
- data/usr/share/omf/diffuse/diffuse-*.omf
14-
- utils/book2manual.xsl
15-
- windows-installer/build.py
16-
- windows-installer/diffuse.iss
17-
- windows-installer/diffuse.new.iss
18-
3. Update the date for the new release date in these files:
19-
- data/usr/share/gnome/help/diffuse/*/diffuse.xml
20-
- data/usr/share/omf/diffuse/diffuse-*.omf
21-
- utils/book2manual.xsl
22-
4. Update CHANGELOG.md
23-
- Add new line under `## Unreleased` following this syntax: `## x.y.z - YYYY-MM-DD`
24-
- Copy the content of the changes for this release
25-
5. Update AppData release notes in data/io.github.mightycreak.Diffuse.appdata.xml.in:
26-
- Create a new `<release>` tag under `<releases>`, fill the `version` and
27-
`date` attributes
28-
- Create a new `<description>` tag under the new `<release>` tag
29-
- Add a paragraph (`<p>`) to sum the release in one sentence (e.g.
30-
highlights, ...)
31-
- Paste the changes from the changelog and adapt it to HTML
32-
6. Create new branch and PR
8+
### Edit files
9+
10+
1. Find the next version, using semantic versioning (e.g. `1.2.3`), depending on
11+
the changes in the changelog
12+
2. Execute `./new_release NEW_VERSION` (replace `NEW_VERSION` with the new version)
13+
3. Update the AppData release notes in data/io.github.mightycreak.Diffuse.appdata.xml.in:
14+
- Look for the empty `<p>` tag under the new `<release>` tag
15+
- Add a paragraph to sum the release in one sentence (e.g. highlights, ...)
16+
- Paste the changes from CHANGELOG.md and adapt it to HTML (see other
17+
releases in the file)
18+
19+
### Create branch, PR and merge
20+
21+
1. Create a new branch (e.g. `release-1.2.3`)
22+
2. Create a new PR
23+
3. When everything's green: merge the PR
3324

3425
## Create new release on GitHub
3526

36-
1. When everything's green: merge the PR
37-
2. Create a new release on GitHub's [new release page](https://github.com/MightyCreak/diffuse/releases/new):
27+
1. Create a new release on GitHub's [new release page](https://github.com/MightyCreak/diffuse/releases/new):
3828
- Choose a tag: `v` followed with the new version (e.g. `v1.2.3`)
3929
- Release title: the tag (e.g. `v1.2.3`)
4030
- Description:
4131
- For the first paragraph, paste the first paragraph from the release notes
4232
- For the second paragraph, got to [CHANGELOG.md](https://github.com/MightyCreak/diffuse/blob/main/CHANGELOG.md)
4333
and copy the URL anchor to the new release, then add this sentence
44-
(adapt the changelog link):
45-
> For a more detailed list of changes, see the
46-
> [changelog](https://github.com/MightyCreak/diffuse/blob/main/CHANGELOG.md#xyz---yyyy-mm-dd).
47-
3. Publish release
34+
(adapt the changelog link):
35+
36+
```text
37+
For a more detailed list of changes, see the
38+
[changelog](https://github.com/MightyCreak/diffuse/blob/main/CHANGELOG.md#xyz---yyyy-mm-dd).
39+
```
40+
41+
2. Publish release
4842
4943
## Create new release on Flatpak
5044

new_release.sh

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

0 commit comments

Comments
 (0)