Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

build(android): build the release variant in CI and add a manual signing dry run

wquguru5fd07b4c62b8
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 4e3e488..ffe8b2e 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -1,7 +1,9 @@
name: android
# The Android app (android/): the engines' unit tests on the JVM, the translation check, then the
-# dev APK as an artifact. Listening itself is tested in the emulator or on a phone.
+# dev APK as an artifact, and the release build so a tag doesn't find it broken. Run by hand with
+# sign on, it also signs with the release key from the secrets and checks it, uploading nothing.
+# Listening itself is tested in the emulator or on a phone.
on:
push:
branches: [main]
@@ -9,6 +11,11 @@ on:
pull_request:
paths: ["android/**", "Resources/**/Localizable.strings", ".github/workflows/android.yml"]
workflow_dispatch:
+ inputs:
+ sign:
+ description: "Also sign with the release key and check it (nothing is uploaded)"
+ type: boolean
+ default: false
jobs:
build:
@@ -37,3 +44,19 @@ jobs:
with:
name: Cicada-android-dev
path: android/app/build/outputs/apk/debug/app-debug.apk
+ - name: Release build
+ run: gradle --console=plain -q :app:assembleRelease
+ # The release workflow's signing, tried before a tag needs it. The signed APK is deleted: the
+ # repo is public, and an artifact would be a release-signed build that was never released.
+ - name: Sign with the release key
+ if: github.event_name == 'workflow_dispatch' && inputs.sign
+ env:
+ ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
+ CICADA_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
+ run: |
+ [[ -n "$ANDROID_KEYSTORE_BASE64" ]] || { echo "no ANDROID_KEYSTORE_BASE64 secret (android/scripts/keystore.sh --github)"; exit 1; }
+ export CICADA_KEYSTORE="$RUNNER_TEMP/release.jks"
+ base64 -d <<< "$ANDROID_KEYSTORE_BASE64" > "$CICADA_KEYSTORE"
+ gradle --console=plain -q :app:assembleRelease
+ scripts/check-release.sh app/build/outputs/apk/release/app-release.apk
+ rm -f "$CICADA_KEYSTORE" app/build/outputs/apk/release/app-release.apk