Release 0.1.5 with a reliable Settings update flow
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m23s

The update button no longer disappears while downloading, so focus can't
be lost and the remote no longer jumps to Home from Settings. It shows
download progress, offers Install again after a cancelled installer, and
restores focus on return. Settings scrolls only as far as needed, shows
just the new version's notes above the buttons, and focused primary
buttons now stand apart from unfocused ones. Release bodies and the
manifest carry only that version's changelog section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-10-24 14:00:32 -07:00
parent 4ac18c8a45
commit 6a53196748
14 changed files with 140 additions and 24 deletions

View file

@ -1,5 +1,5 @@
"""Stage a locally signed APK for Git distribution and tag-triggered Forgejo releases."""
import hashlib, json, pathlib, shutil, subprocess
import hashlib, json, pathlib, re, shutil, subprocess
ROOT=pathlib.Path(__file__).resolve().parents[1]
version=dict(l.split('=',1) for l in (ROOT/'version.properties').read_text().splitlines() if '=' in l)
apk=ROOT/'app/build/outputs/apk/release/app-release.apk'
@ -10,6 +10,9 @@ digest=hashlib.sha256(apk.read_bytes()).hexdigest()
(out/'Kaleido.apk.sha256').write_text(digest+' Kaleido.apk\n')
repo='https://git.elijahkuntz.com/Elijah/Kaleido'
tag='v'+version['versionName']
manifest={'version':version['versionName'],'versionCode':int(version['versionCode']),'url':repo+'/raw/tag/'+tag+'/distribution/Kaleido.apk','checksumUrl':repo+'/raw/tag/'+tag+'/distribution/Kaleido.apk.sha256','notes':(ROOT/'CHANGELOG.md').read_text().split('\n## ')[1].split('\n## ')[0] if (ROOT/'CHANGELOG.md').exists() else ''}
# Only this version's section, matching the release body the app shows as notes.
changelog=(ROOT/'CHANGELOG.md').read_text() if (ROOT/'CHANGELOG.md').exists() else ''
section=re.search(r'^## v?'+re.escape(version['versionName'])+r'[ \t]*$(.*?)(?=^## |\Z)',changelog,re.M|re.S)
manifest={'version':version['versionName'],'versionCode':int(version['versionCode']),'url':repo+'/raw/tag/'+tag+'/distribution/Kaleido.apk','checksumUrl':repo+'/raw/tag/'+tag+'/distribution/Kaleido.apk.sha256','notes':section.group(1).strip() if section else ''}
(out/'latest.json').write_text(json.dumps(manifest,indent=2)+'\n')
print('Packaged',tag,'SHA-256',digest)

View file

@ -1,5 +1,5 @@
"""Publish the checked-in, signed APK using Forgejo's repository-scoped CI token."""
import hashlib, json, os, pathlib, urllib.request, uuid
import hashlib, json, os, pathlib, re, urllib.request, uuid
ROOT=pathlib.Path(__file__).resolve().parents[1]
API='https://git.elijahkuntz.com/api/v1/repos/Elijah/Kaleido'
token=os.environ['KALEIDO_RELEASE_TOKEN']
@ -8,6 +8,11 @@ tag='v'+version['versionName']
ref=os.environ.get('RELEASE_REF','')
assert ref=='refs/tags/'+tag,'Tag must match version.properties exactly'
out=ROOT/'distribution'
def notes():
"""Only this version's changelog section; the app shows the body as release notes."""
text=(ROOT/'CHANGELOG.md').read_text()
m=re.search(r'^## v?'+re.escape(version['versionName'])+r'[ \t]*$(.*?)(?=^## |\Z)',text,re.M|re.S)
return m.group(1).strip() if m else ''
assert hashlib.sha256((out/'Kaleido.apk').read_bytes()).hexdigest()==(out/'Kaleido.apk.sha256').read_text().split()[0]
def call(path,data=None,method=None,content='application/json'):
req=urllib.request.Request(API+path,data=data,method=method,headers={'Authorization':'token '+token,'Content-Type':content})
@ -15,7 +20,7 @@ def call(path,data=None,method=None,content='application/json'):
try:release=call('/releases/tags/'+tag)
except urllib.error.HTTPError as e:
if e.code!=404:raise
release=call('/releases',json.dumps({'tag_name':tag,'name':'Kaleido '+version['versionName'],'body':(ROOT/'CHANGELOG.md').read_text(),'draft':True,'prerelease':False}).encode(),'POST')
release=call('/releases',json.dumps({'tag_name':tag,'name':'Kaleido '+version['versionName'],'body':notes(),'draft':True,'prerelease':False}).encode(),'POST')
existing={a['name']:a for a in release.get('assets',[])}
for name in ['Kaleido.apk','Kaleido.apk.sha256']:
if name in existing:continue