Stop a hand-picked build number from stranding the phone

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-08-31 11:45:04 +02:00
parent 6e668df5c1
commit 25321d88fa
2 changed files with 16 additions and 2 deletions

View File

@ -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:

1
.versioncode-offset Normal file
View File

@ -0,0 +1 @@
101