Files
tern-android/.gitea/workflows/release.yml
T
Mateusz PstruchaandClaude Opus 5.5 d7ee8b7c46
CI / build (push) Successful in 10m25s
Release / apk (push) Successful in 4m14s
Build the Android client with UnifiedPush notifications
The mail client from android-client-spec.md on AGP 9.4 / Kotlin 2.4 /
compileSdk 37: sign-in and first-run (account, then notifications),
adaptive list-detail with a modal or permanent drawer, swipe to archive
or delete, a locked-down WebView for HTML mail with remote images
blocked per message, reply/reply-all/compose with drafts and an outbox,
and Material You theming with the brand palette as fallback.

Mail is cached in Room and kept current by delta sync over
/api/events. UnifiedPush (connector only, no FCM) delivers the server's
content-free wake-ups; a WorkManager job syncs and raises one
MessagingStyle notification per thread with Archive and Mark read, and
drops notifications for threads read elsewhere. Settings shows push
state, picks a distributor and sends a test push.

The session token is encrypted with a Keystore key, backups are off,
release builds are HTTPS-only (trusting user-installed CAs). CI now
pins platform 37 / build-tools 36 and runs unit tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 21:03:11 +02:00

110 lines
4.3 KiB
YAML

name: Release
on:
push:
tags: ['v*']
jobs:
apk:
runs-on: rocky-10
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
# See ci.yml — installed explicitly so SDK package versions stay
# pinned to match the build config.
- name: Set up Android SDK
run: |
set -eu
SDK="$HOME/android-sdk"
if [ ! -d "$SDK/cmdline-tools/latest" ]; then
mkdir -p "$SDK/cmdline-tools"
curl -sSLo /tmp/cmdline-tools.zip \
https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
unzip -q /tmp/cmdline-tools.zip -d "$SDK/cmdline-tools"
mv "$SDK/cmdline-tools/cmdline-tools" "$SDK/cmdline-tools/latest"
rm -f /tmp/cmdline-tools.zip
fi
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null 2>&1 || true
"$SDK/cmdline-tools/latest/bin/sdkmanager" \
"platform-tools" "platforms;android-37.0" "build-tools;36.0.0" >/dev/null
echo "ANDROID_HOME=$SDK" >> "$GITHUB_ENV"
echo "ANDROID_SDK_ROOT=$SDK" >> "$GITHUB_ENV"
- name: Cache Gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: gradle-${{ hashFiles('**/*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: gradle-
- name: Derive version
id: version
run: |
VERSION="${GITHUB_REF_NAME#v}"
MAJOR="${VERSION%%.*}"; REST="${VERSION#*.}"
MINOR="${REST%%.*}"; PATCH="${REST#*.}"
PATCH="${PATCH%%-*}" # drop any -rc1 suffix
# Monotonic and human-readable: 0.3.1 -> 301, 1.12.0 -> 11200.
# Android requires versionCode to only ever increase; deriving it
# from the tag means it can't drift from what users see.
echo "name=$VERSION" >> "$GITHUB_OUTPUT"
echo "code=$((MAJOR * 10000 + MINOR * 100 + PATCH))" >> "$GITHUB_OUTPUT"
- name: Decode keystore
env:
KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
run: |
if [ -z "$KEYSTORE_B64" ]; then
echo "::error::ANDROID_KEYSTORE_B64 is not set — refusing to publish an unsigned release."
exit 1
fi
# Resolve the path here rather than via ${{ runner.temp }}: if that
# context is empty on this runner, the keystore would be written to
# an unintended location. Export it so later steps use the same one.
KS="${RUNNER_TEMP:-${GITHUB_WORKSPACE:-$PWD}}/tern-release.jks"
echo "$KEYSTORE_B64" | base64 -d > "$KS"
chmod 600 "$KS"
echo "TERN_KEYSTORE_PATH=$KS" >> "$GITHUB_ENV"
- name: Build signed APK
env:
TERN_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
TERN_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
TERN_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
TERN_VERSION_NAME: ${{ steps.version.outputs.name }}
TERN_VERSION_CODE: ${{ steps.version.outputs.code }}
run: ./gradlew assembleRelease --no-daemon
- name: Verify signature and stage artifact
run: |
APK=app/build/outputs/apk/release/app-release.apk
APKSIGNER="$(find "$ANDROID_HOME/build-tools" -name apksigner | sort -V | tail -1)"
# Fails loudly if the APK came out unsigned — otherwise an
# unsigned build would sail through to a published release.
"$APKSIGNER" verify --print-certs "$APK"
cp "$APK" "tern-${{ steps.version.outputs.name }}.apk"
sha256sum "tern-${{ steps.version.outputs.name }}.apk" \
> "tern-${{ steps.version.outputs.name }}.apk.sha256"
- name: Clean up keystore
if: always()
run: rm -f "${TERN_KEYSTORE_PATH:-}"
- name: Create release
uses: akkuman/gitea-release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
server_url: ${{ gitea.server_url }}
tag_name: ${{ gitea.ref_name }}
name: ${{ gitea.ref_name }}
files: |-
tern-*.apk
tern-*.apk.sha256