Skip to content

Latest commit

 

History

History
78 lines (49 loc) · 4.91 KB

RELEASING.md

File metadata and controls

78 lines (49 loc) · 4.91 KB

Releasing

Every push and pull request runs the unit tests and the speech check and builds a debug APK and a release APK, but keeps neither. To download them, run the workflow by hand (Actions → Build → Run workflow); the APKs are then under that run's Artifacts for 7 days. Pushing a tag v* builds a release-signed APK and publishes it, with its SHA-256, as a GitHub Release.

Give other people releases, not Actions artifacts. The APK includes eSpeak NG (GPL-3.0-or-later), so once the repository is public a downloadable artifact is a GPL distribution, and an artifact carries no directions to the Corresponding Source; a release attaches the sources and says where the rest is (LICENSING.md section 1.3).

Do this before the real setup

Android only installs an update signed with the same key as the installed app. The builds installed so far are signed with a debug key, so the first switch to a release-signed build means uninstalling the app, which wipes the lights, the TV pairing and every setting. Make the switch once, before setting the tablet up for real, and only install release builds after that.

1. Create the signing key (once)

On your own computer, not in the repository:

keytool -genkeypair -v -keystore privateassistant-release.jks -storetype PKCS12 \
  -alias privateassistant -keyalg RSA -keysize 4096 -validity 10000

It asks for a password and a name; for PKCS12 the key password is the same as the store password. Keep the file and the password somewhere safe, such as a password manager: a lost key means the next install is an uninstall. Never commit it (*.keystore is ignored; .jks files should not be added either).

2. Add the four repository secrets

Encode the file as one line of base64:

base64 -w0 privateassistant-release.jks > keystore.b64        # Linux
base64 -i privateassistant-release.jks | tr -d '\n' > keystore.b64   # macOS

On GitHub open Settings → Secrets and variables → Actions → New repository secret and add:

Secret Value
PA_KEYSTORE_BASE64 the contents of keystore.b64
PA_KEYSTORE_PASSWORD the store password
PA_KEY_ALIAS privateassistant (the -alias above)
PA_KEY_PASSWORD the key password (the same as the store password for PKCS12)

Delete keystore.b64 afterwards. With the secrets in place, the release APK from every push is also release-signed.

With gh: gh secret set PA_KEYSTORE_BASE64 < keystore.b64, then gh secret set PA_KEYSTORE_PASSWORD and so on (it prompts for the value).

3. Cut a release

git tag v0.2.0
git push origin v0.2.0

The Release workflow runs the tests, builds both privateassistant-v0.2.0.apk (tablet) and privateassistant-lights-v0.2.0.apk (phone companion), and publishes them with .sha256 files and GPL Corresponding Source archives. It refuses to publish if any secret is missing, rather than publishing debug-signed APKs.

On the tablet, download the APK from the release page and open it. Check the checksum first if you like: sha256sum privateassistant-v0.2.0.apk. Settings → Tablet & privacy → Advanced → Check for updates compares the installed version with the latest release of the repository in AppSettings.updateRepository (only when pressed; a private repository cannot be checked this way).

Version numbers

  • versionCode is the number of commits on the built branch, so every later build is higher. CI checks out the full history for this (fetch-depth: 0). Override with PA_VERSION_CODE.
  • versionName is the tag without its v when building a tag (v0.2.0 → 0.2.0), otherwise 0.1.<commit count>. Override with PA_VERSION_NAME.

Building a signed release on your own computer

The same names work as environment variables or Gradle properties (-P… or ~/.gradle/gradle.properties). Give a file instead of base64 with PA_KEYSTORE_FILE:

PA_KEYSTORE_FILE=~/keys/privateassistant-release.jks PA_KEYSTORE_PASSWORD=… PA_KEY_ALIAS=privateassistant PA_KEY_PASSWORD=… \
  ./gradlew :app:assembleRelease
adb install -r --user 10 app/build/outputs/apk/release/app-release.apk

Without them the build still succeeds, signs the release APK with the debug key and prints a warning. Release builds are never debuggable, so the light and TV keys cannot be copied off the tablet over USB.

Backups

The app opts out of cloud backup and device-to-device transfer entirely (res/xml/data_extraction_rules.xml, res/xml/backup_rules.xml): the network keys, the TV certificate and the PIN hash never leave the tablet. Moving to a new tablet means setting it up again.

Forgotten Settings PIN

The PIN is stored only as a salted hash and cannot be recovered. On the tablet open the system Settings → Apps → Home → Storage → Clear data (or adb shell pm clear --user 10 dev.privateassistant.app). That removes the PIN and the lights, TV pairing and setup, which then have to be done again.