add script for releases

So i don't keep forgetting to bump various things.
This commit is contained in:
Henry Hiles 2026-11-16 12:41:27 -05:00
commit 8b2702c444
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 37 additions and 0 deletions

View file

@ -12,6 +12,16 @@ You can run the following command to update the Gomuks submodule:
git submodule update --remote git submodule update --remote
``` ```
## Releasing
To make a release, run the following command with the new version, either `X.Y.Z` or a pre-release like `X.Y.Z-alpha1`:
```sh
scripts/release.sh 1.2.0
```
This sets the version in `pubspec.yaml` (along with the Android version code), the Windows installer, the AppStream metainfo and the README, then commits and tags it. Push it with the command it prints, then attach the artifacts from the tag's CI run to the release.
## Code Style ## Code Style
See [Effective Dart: Style](https://dart.dev/effective-dart/style) for general rules. There are some extra rules detailed below: See [Effective Dart: Style](https://dart.dev/effective-dart/style) for general rules. There are some extra rules detailed below:

27
scripts/release.sh Normal file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
version=${1:?usage: $0 <version>, e.g. 1.2.0 or 1.2.0-beta1}
[[ $version =~ ^([0-9]+)\.([0-9]{1,2})\.([0-9]{1,2})(-[a-z]+([0-9]{1,3}))?$ ]] ||
{ echo "invalid version: $version" >&2; exit 1; }
prerelease=${BASH_REMATCH[5]:-}
code=$((10#${BASH_REMATCH[1]} * 100000000 + 10#${BASH_REMATCH[2]} * 1000000 + 10#${BASH_REMATCH[3]} * 10000 + 10#${prerelease:-999}))
cd "$(dirname "$0")/.."
git diff --quiet HEAD || { echo "commit or stash your changes first" >&2; exit 1; }
! git rev-parse -q --verify "refs/tags/v$version" > /dev/null || { echo "v$version already exists" >&2; exit 1; }
sed -i "s/^version: .*/version: $version+$code/" pubspec.yaml
sed -i "s/^AppVersion=.*/AppVersion=$version/" windows/installer.iss
if [[ $prerelease ]]; then
release="<release version=\"$version\" date=\"$(date +%F)\" type=\"development\"/>"
else
release="<release version=\"$version\" date=\"$(date +%F)\"/>"
sed -i "s|refs/tags/v[^\"]*\"|refs/tags/v$version\"|" README.md
fi
sed -i "s|^\( *\)<releases>|&\n\1 $release|" linux/nexus.federated.nexus.metainfo.xml
git commit -qam "prepare v$version"
git tag "v$version"
echo "Tagged v$version ($code). Push with: git push origin HEAD v$version"