From d4952db497fbaaaffe6bceb27146dc05e59fb6ba Mon Sep 17 00:00:00 2001 From: foxyz Date: Tue, 13 Oct 2026 01:21:46 +0300 Subject: [PATCH] dev_release.sh: --minor / --major start a new dev line, later runs follow it Co-Authored-By: Claude Opus 5.5 --- docs/DEVELOPMENT.md | 11 +++++++---- tool/dev_release.sh | 26 +++++++++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index 49997c1..d2ce63f 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -107,10 +107,13 @@ User pushes tags; CI does the rest. release if the other job hasn't yet and uploads (or replaces) its asset. By hand: package, then the same `dart tool/release_publish.dart` line. -Test builds (Linux, no tag, no CI): `tool/dev_release.sh [--no-publish]` -(token: `RELEASE_TOKEN` or `~/.config/watch-together-release-token`, a -Gitea access token with repository read/write) builds the working tree here as the next patch's -`-dev.N` (N one past the published one) and replaces the assets of the +Test builds (Linux, no tag, no CI): `tool/dev_release.sh [--minor|--major] +[--no-publish]` (token: `RELEASE_TOKEN` or +`~/.config/watch-together-release-token`, a Gitea access token with +repository read/write) builds the working tree here as `-dev.N` (N +one past the published one; `` the pubspec's next patch, or next +minor / major when asked, and once such a line is published later runs +follow it until a release moves the pubspec) and replaces the assets of the `dev` prerelease with the tarball and its `manifest.json`. Dev builds update from it ([Updater](ARCHITECTURE.md#updater)). A stable install moves onto it once with the command the script prints (run with the app diff --git a/tool/dev_release.sh b/tool/dev_release.sh index 53bd475..4359274 100755 --- a/tool/dev_release.sh +++ b/tool/dev_release.sh @@ -2,19 +2,25 @@ # Build a Linux test build here and publish it to the `dev` prerelease on # Gitea, where dev builds update from (see Updater in docs/ARCHITECTURE.md). # No tag push, no CI, no commit: the working tree is built as it is. -# Usage: tool/dev_release.sh [--no-publish] -# Version: the next patch after the pubspec's, `-dev.N`, N one past the -# published dev build of that patch (1.1.2 -> 1.1.3-dev.1, -dev.2, ...). +# Usage: tool/dev_release.sh [--minor|--major] [--no-publish] +# Version: `-dev.N`, N one past the published dev build of that +# version. is the next patch after the pubspec's (1.1.2 -> 1.1.3), +# or with --minor / --major the next minor / major (1.2.0 / 2.0.0); once a +# dev line is published past the pubspec's next patch, later runs keep +# following it (1.2.0-dev.2, ...) until the release moves the pubspec. # Token: RELEASE_TOKEN, else the file ~/.config/watch-together-release-token # (a Gitea access token with repository read/write; keep the file 0600). # Prints the one-time command that moves a stable install onto test builds. set -euo pipefail PUBLISH=1 +BUMP=patch for arg in "$@"; do case "$arg" in --no-publish) PUBLISH=0 ;; - *) echo "usage: $0 [--no-publish]" >&2; exit 1 ;; + --minor) BUMP=minor ;; + --major) BUMP=major ;; + *) echo "usage: $0 [--minor|--major] [--no-publish]" >&2; exit 1 ;; esac done TOKEN_FILE="$HOME/.config/watch-together-release-token" @@ -30,9 +36,19 @@ BASE_URL="https://git.senkochan.moe/Foxyz/sync_replay_project/releases/download/ PUB="$(sed -n 's/^version: \([0-9.]*\).*/\1/p' "$ROOT/apps/desktop/pubspec.yaml")" IFS=. read -r MA MI PA <<<"$PUB" -NEXT="$MA.$MI.$((PA + 1))" +case "$BUMP" in + patch) NEXT="$MA.$MI.$((PA + 1))" ;; + minor) NEXT="$MA.$((MI + 1)).0" ;; + major) NEXT="$((MA + 1)).0.0" ;; +esac LAST="$(curl -fsSL "$BASE_URL/manifest.json" 2>/dev/null | python3 -I -c 'import json,sys; print(json.load(sys.stdin)["version"])' 2>/dev/null || true)" +# A published dev line past (started with --minor/--major) wins. +LAST_BASE="${LAST%%-dev.*}" +if [[ -n "$LAST" && "$LAST_BASE" != "$NEXT" && + "$(printf '%s\n%s\n' "$NEXT" "$LAST_BASE" | sort -V | tail -1)" == "$LAST_BASE" ]]; then + NEXT="$LAST_BASE" +fi N=1 if [[ "$LAST" == "$NEXT-dev."* ]]; then N=$(( ${LAST##*-dev.} + 1 )); fi export VERSION="$NEXT-dev.$N"