From 93f0527ee365829bb1d72dbadbcb7fa5ba29abca Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Sun, 16 Apr 2023 13:05:07 -0400 Subject: [PATCH] chore: add `new_release.sh` script to prepare for new releases --- docs/developers/release-process.md | 56 ++++++++++----------- new_release.sh | 79 ++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 31 deletions(-) create mode 100755 new_release.sh diff --git a/docs/developers/release-process.md b/docs/developers/release-process.md index cb33063..4b82206 100644 --- a/docs/developers/release-process.md +++ b/docs/developers/release-process.md @@ -5,46 +5,40 @@ few manual steps. ## Prepare the PR for the new release -1. Find the next version, using semantic versioning, depending on the changes - in the changelog -2. Find and replace the old version with the new version in some files: - - 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 -3. Update the date for the new release date in these files: - - data/usr/share/gnome/help/diffuse/*/diffuse.xml - - data/usr/share/omf/diffuse/diffuse-*.omf - - utils/book2manual.xsl -4. Update CHANGELOG.md - - Add new line under `## Unreleased` following this syntax: `## x.y.z - YYYY-MM-DD` - - Copy the content of the changes for this release -5. Update AppData release notes in data/io.github.mightycreak.Diffuse.appdata.xml.in: - - Create a new `` tag under ``, fill the `version` and - `date` attributes - - Create a new `` tag under the new `` tag - - Add a paragraph (`

`) to sum the release in one sentence (e.g. - highlights, ...) - - Paste the changes from the changelog and adapt it to HTML -6. Create new branch and PR +### Edit files + +1. Find the next version, using semantic versioning (e.g. `1.2.3`), depending on + the changes in the changelog +2. Execute `./new_release NEW_VERSION` (replace `NEW_VERSION` with the new version) +3. Update the AppData release notes in data/io.github.mightycreak.Diffuse.appdata.xml.in: + - Look for the empty `

` tag under the new `` tag + - Add a paragraph to sum the release in one sentence (e.g. highlights, ...) + - Paste the changes from CHANGELOG.md and adapt it to HTML (see other + releases in the file) + +### Create branch, PR and merge + +1. Create a new branch (e.g. `release-1.2.3`) +2. Create a new PR +3. When everything's green: merge the PR ## Create new release on GitHub -1. When everything's green: merge the PR -2. Create a new release on GitHub's [new release page](https://github.com/MightyCreak/diffuse/releases/new): +1. Create a new release on GitHub's [new release page](https://github.com/MightyCreak/diffuse/releases/new): - Choose a tag: `v` followed with the new version (e.g. `v1.2.3`) - Release title: the tag (e.g. `v1.2.3`) - Description: - For the first paragraph, paste the first paragraph from the release notes - For the second paragraph, got to [CHANGELOG.md](https://github.com/MightyCreak/diffuse/blob/main/CHANGELOG.md) and copy the URL anchor to the new release, then add this sentence - (adapt the changelog link): - > For a more detailed list of changes, see the - > [changelog](https://github.com/MightyCreak/diffuse/blob/main/CHANGELOG.md#xyz---yyyy-mm-dd). -3. Publish release + (adapt the changelog link): + + ```text + For a more detailed list of changes, see the + [changelog](https://github.com/MightyCreak/diffuse/blob/main/CHANGELOG.md#xyz---yyyy-mm-dd). + ``` + +2. Publish release ## Create new release on Flatpak diff --git a/new_release.sh b/new_release.sh new file mode 100755 index 0000000..1226aeb --- /dev/null +++ b/new_release.sh @@ -0,0 +1,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 `` tag under ``, fill the `version` and `date` attributes +## - Create a new `` tag under the new `` tag +## - Create a new `

` tag under the new `` 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/version: '.+?',/version: '$NEW_VERSION',/" \ + meson.build + +# GNOME help (.xml and .omf) +sed -i -E "s###" \ + data/usr/share/gnome/help/diffuse/*/diffuse.xml +sed -i -E "s###" \ + data/usr/share/gnome/help/diffuse/*/diffuse.xml +sed -i -E "s###" \ + data/usr/share/gnome/help/diffuse/*/diffuse.xml + +sed -i -E "s###" \ + data/usr/share/omf/diffuse/diffuse-*.omf +sed -i -E "s#.+?#$DATE_FULL#" \ + data/usr/share/omf/diffuse/diffuse-*.omf + +# book2manual.xsl +sed -i -E "s###" \ + utils/book2manual.xsl +sed -i -E "s###" \ + 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=" + +

+
+
" +echo "$new_release" | sed -i "//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."