From 25321d88fa47e52061e9bec96cb33426d2145a80 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Mon, 31 Aug 2026 11:45:04 +0200 Subject: [PATCH] Stop a hand-picked build number from stranding the phone Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/release-apk.yml | 17 +++++++++++++++-- .versioncode-offset | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .versioncode-offset diff --git a/.github/workflows/release-apk.yml b/.github/workflows/release-apk.yml index 3296e80..6d050d1 100644 --- a/.github/workflows/release-apk.yml +++ b/.github/workflows/release-apk.yml @@ -39,9 +39,22 @@ jobs: # versionCode is the commit count; a shallow clone would report 1. fetch-depth: 0 - - name: Derive versionCode from the commit count + # `.versioncode-offset` is the recovery valve for a phone stranded + # above CI by a hand-numbered local build. Android only ever compares + # versionCode upward, so a device ahead of CI locks CI out permanently + # and the only other escape is an uninstall, which wipes app data. + # ~/.claude/scripts/lib/phone_deploy_version.sh reads the SAME file, so + # raising it moves both sides together; raising either alone re-strands + # the device. Never lower it. + - name: Derive versionCode from the commit count plus the offset id: vc - run: echo "code=$(git rev-list --count HEAD)" >> "$GITHUB_OUTPUT" + run: | + offset=0 + if [[ -r .versioncode-offset ]]; then + read -r offset < .versioncode-offset + fi + [[ "$offset" =~ ^[0-9]+$ ]] || offset=0 + echo "code=$(( $(git rev-list --count HEAD) + offset ))" >> "$GITHUB_OUTPUT" - uses: actions/setup-java@v4 with: diff --git a/.versioncode-offset b/.versioncode-offset new file mode 100644 index 0000000..398050c --- /dev/null +++ b/.versioncode-offset @@ -0,0 +1 @@ +101