From 8b2702c44418afabfa448d3a0e8ccc2e752317a6 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Mon, 16 Nov 2026 12:41:27 -0500 Subject: [PATCH] add script for releases So i don't keep forgetting to bump various things. --- DEVELOPMENT.md | 10 ++++++++++ scripts/release.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 scripts/release.sh diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index fa4a0a1..0f73f6a 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -12,6 +12,16 @@ You can run the following command to update the Gomuks submodule: 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 See [Effective Dart: Style](https://dart.dev/effective-dart/style) for general rules. There are some extra rules detailed below: diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100644 index 0000000..01e2683 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -euo pipefail + +version=${1:?usage: $0 , 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="" +else + release="" + sed -i "s|refs/tags/v[^\"]*\"|refs/tags/v$version\"|" README.md +fi +sed -i "s|^\( *\)|&\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"