ci(release): persist signing keystore in runner cache for stable signatures
dev / Build debug APK (push) Successful in 36s
release / Build & attach release APK (push) Successful in 6m50s

The build step minted a fresh keystore inside the checkout on every
run, so each CI release was signed with a different key. Upgrading
from any previous release then failed with a signature conflict
(INSTALL_FAILED_UPDATE_INCOMPATIBLE) — and with allowBackup=false,
the only workaround was uninstalling, which destroys the user's
notes.

The keystore is now minted once in /tmp/gitea-runner-work (the same
persistent cache that already holds the JDK and Android SDK) and
copied into the checkout before building. Every release from now on
shares one signing key, so in-place upgrades work. Only a runner-host
rebuild would mint a new key (breaking exactly one upgrade).

Note: v0.3.7.0 was signed with an ephemeral key that no longer
exists, so the v0.3.7.0 -> v0.3.7.1 upgrade still requires a one-time
uninstall (export a backup first).
This commit is contained in:
Incido Developer committed 2026-08-30 11:02:50 +12:00
1 parent 4a28f4f52b
commit 576080c8b5
1 file changed
+14 -2
+14 -2
View File
@@ -58,16 +58,28 @@ jobs:
run: | run: |
cd repo cd repo
git checkout ${{ github.ref_name }} git checkout ${{ github.ref_name }}
# Persistent signing keystore: minted ONCE in the runner's
# cache dir (which survives across runs, same place the JDK
# and SDK live) and copied into the checkout. Every release
# is therefore signed with the SAME key, so users can
# upgrade in place instead of hitting a signature conflict
# (and, with allowBackup=false, losing their notes).
# A runner-host rebuild would mint a fresh key — the only
# scenario that breaks one upgrade.
mkdir -p keystore mkdir -p keystore
if [ ! -f keystore/release.jks ]; then if [ ! -f /tmp/gitea-runner-work/release.jks ]; then
echo "Minting new persistent CI keystore"
keytool -genkey -noprompt -v \ keytool -genkey -noprompt -v \
-keystore keystore/release.jks \ -keystore /tmp/gitea-runner-work/release.jks \
-keyalg RSA -keysize 2048 -validity 10000 \ -keyalg RSA -keysize 2048 -validity 10000 \
-alias incido \ -alias incido \
-storepass incido_dev_keystore \ -storepass incido_dev_keystore \
-keypass incido_dev_keystore \ -keypass incido_dev_keystore \
-dname "CN=Incido Dev, OU=Local, O=Incido, L=Local, ST=Local, C=NZ" -dname "CN=Incido Dev, OU=Local, O=Incido, L=Local, ST=Local, C=NZ"
else
echo "Reusing persistent CI keystore from runner cache"
fi fi
cp /tmp/gitea-runner-work/release.jks keystore/release.jks
export JAVA_HOME=/tmp/gitea-runner-work/jdk export JAVA_HOME=/tmp/gitea-runner-work/jdk
export ANDROID_HOME=/tmp/gitea-runner-work/android-sdk export ANDROID_HOME=/tmp/gitea-runner-work/android-sdk
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH