dev_release.sh: --minor / --major start a new dev line, later runs follow it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
foxyzandClaude Opus 5.5 committed 2026-10-13 01:21:46 +03:00
1 parent 50b2b000a4
commit d4952db497
2 files changed
+28 -9

No files matched your search

+7 -4
View File
@@ -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. 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. 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]` Test builds (Linux, no tag, no CI): `tool/dev_release.sh [--minor|--major]
(token: `RELEASE_TOKEN` or `~/.config/watch-together-release-token`, a [--no-publish]` (token: `RELEASE_TOKEN` or
Gitea access token with repository read/write) builds the working tree here as the next patch's `~/.config/watch-together-release-token`, a Gitea access token with
`-dev.N` (N one past the published one) and replaces the assets of the repository read/write) builds the working tree here as `<next>-dev.N` (N
one past the published one; `<next>` 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 `dev` prerelease with the tarball and its `manifest.json`. Dev builds
update from it ([Updater](ARCHITECTURE.md#updater)). A stable install update from it ([Updater](ARCHITECTURE.md#updater)). A stable install
moves onto it once with the command the script prints (run with the app moves onto it once with the command the script prints (run with the app
+21 -5
View File
@@ -2,19 +2,25 @@
# Build a Linux test build here and publish it to the `dev` prerelease on # 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). # 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. # No tag push, no CI, no commit: the working tree is built as it is.
# Usage: tool/dev_release.sh [--no-publish] # Usage: tool/dev_release.sh [--minor|--major] [--no-publish]
# Version: the next patch after the pubspec's, `-dev.N`, N one past the # Version: `<next>-dev.N`, N one past the published dev build of that
# published dev build of that patch (1.1.2 -> 1.1.3-dev.1, -dev.2, ...). # version. <next> 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 # Token: RELEASE_TOKEN, else the file ~/.config/watch-together-release-token
# (a Gitea access token with repository read/write; keep the file 0600). # (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. # Prints the one-time command that moves a stable install onto test builds.
set -euo pipefail set -euo pipefail
PUBLISH=1 PUBLISH=1
BUMP=patch
for arg in "$@"; do for arg in "$@"; do
case "$arg" in case "$arg" in
--no-publish) PUBLISH=0 ;; --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 esac
done done
TOKEN_FILE="$HOME/.config/watch-together-release-token" 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")" PUB="$(sed -n 's/^version: \([0-9.]*\).*/\1/p' "$ROOT/apps/desktop/pubspec.yaml")"
IFS=. read -r MA MI PA <<<"$PUB" 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 | 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)" python3 -I -c 'import json,sys; print(json.load(sys.stdin)["version"])' 2>/dev/null || true)"
# A published dev line past <next> (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 N=1
if [[ "$LAST" == "$NEXT-dev."* ]]; then N=$(( ${LAST##*-dev.} + 1 )); fi if [[ "$LAST" == "$NEXT-dev."* ]]; then N=$(( ${LAST##*-dev.} + 1 )); fi
export VERSION="$NEXT-dev.$N" export VERSION="$NEXT-dev.$N"