114 lines
4.8 KiB
YAML
114 lines
4.8 KiB
YAML
name: Android
|
|
|
|
# Builds Choano's three Android downloads from this commit, signs them with
|
|
# the Choano release key and keeps them as workflow artifacts:
|
|
# choano-vVERSION.apk and choano-VERSION-fdroid.apk (the same Google-free
|
|
# build; Choano has no self-update) and choano-vVERSION-gplay.apk, the only
|
|
# one with a Google library. VERSION is the newest numbered changelog entry
|
|
# (0.0.0 before the first release). The Downloads workflow publishes the
|
|
# APKs of a master commit with an unreleased version from these artifacts.
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: choano-android-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
android:
|
|
name: Signed Android APKs (${{ matrix.edition }})
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 90
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
edition: [direct, gplay]
|
|
env:
|
|
ZIRAN_PAR_THREADS: '1'
|
|
MAKEFLAGS: -j1
|
|
CMAKE_BUILD_PARALLEL_LEVEL: '1'
|
|
defaults:
|
|
run:
|
|
working-directory: waozixyz/choano
|
|
steps:
|
|
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
|
|
with:
|
|
path: waozixyz/choano
|
|
persist-credentials: false
|
|
- uses: ziranlang/ziran/.github/actions/setup@979159a55bcf1f9edb9eb8f26ea10aca421412e2
|
|
with:
|
|
project: waozixyz/choano
|
|
path: ziranlang/ziran
|
|
fetch: true
|
|
packages: build-essential cmake meson ninja-build pkg-config zlib1g-dev python3-pil
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '21'
|
|
- name: Install the pinned Android SDK parts
|
|
run: |
|
|
sdkmanager="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
|
|
yes | "$sdkmanager" --licenses > /dev/null
|
|
"$sdkmanager" --install 'ndk;28.2.13676358' 'build-tools;36.0.0' 'platforms;android-36' 'cmake;3.22.1' > /dev/null
|
|
# Only the Google Play edition may name a Google library, in its build
|
|
# files as in its APK.
|
|
- name: Keep Google libraries out of the normal and F-Droid build files
|
|
if: matrix.edition == 'direct'
|
|
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
|
|
with:
|
|
source: waozixyz/choano
|
|
- name: Build the release APK
|
|
run: python3 scripts/android.py build --edition ${{ matrix.edition }}
|
|
- name: Keep Google libraries out of the normal and F-Droid APK
|
|
if: matrix.edition == 'direct'
|
|
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
|
|
with:
|
|
packages: waozixyz/choano/build/android/choano-unsigned.apk
|
|
source: ''
|
|
# The check must still recognise Play Billing, or its passes on the
|
|
# other editions prove nothing.
|
|
- name: Find Play Billing in the Google Play APK
|
|
if: matrix.edition == 'gplay'
|
|
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
|
|
with:
|
|
packages: waozixyz/choano/build/android/choano-gplay-unsigned.apk
|
|
source: ''
|
|
expect-google: 'true'
|
|
- name: Sign and verify the APK
|
|
if: github.event_name != 'pull_request'
|
|
env:
|
|
KEYSTORE: ${{ secrets.CHOANO_ANDROID_KEYSTORE }}
|
|
PASSWORD: ${{ secrets.CHOANO_ANDROID_KEYSTORE_PASSWORD }}
|
|
EDITION: ${{ matrix.edition }}
|
|
run: |
|
|
set -euo pipefail
|
|
umask 077
|
|
test -n "$KEYSTORE" && test -n "$PASSWORD"
|
|
trap 'rm -f "$RUNNER_TEMP/choano-release.p12" "$RUNNER_TEMP/choano-password"' EXIT
|
|
printf '%s' "$KEYSTORE" | base64 -d > "$RUNNER_TEMP/choano-release.p12"
|
|
printf '%s\n' "$PASSWORD" > "$RUNNER_TEMP/choano-password"
|
|
version=$(python3 scripts/android.py version)
|
|
signing=(--keystore "$RUNNER_TEMP/choano-release.p12" --password-file "$RUNNER_TEMP/choano-password")
|
|
if [ "$EDITION" = gplay ]; then
|
|
python3 scripts/android.py sign build/android/choano-gplay-unsigned.apk --edition gplay "${signing[@]}" \
|
|
--output "build/downloads/choano-v$version-gplay.apk"
|
|
else
|
|
python3 scripts/android.py sign build/android/choano-unsigned.apk "${signing[@]}" \
|
|
--output "build/downloads/choano-v$version.apk"
|
|
cp "build/downloads/choano-v$version.apk" "build/downloads/choano-$version-fdroid.apk"
|
|
python3 scripts/android.py verify "build/downloads/choano-$version-fdroid.apk"
|
|
fi
|
|
- uses: actions/upload-artifact@v4
|
|
if: github.event_name != 'pull_request'
|
|
with:
|
|
name: choano-android-${{ matrix.edition }}
|
|
path: waozixyz/choano/build/downloads/*.apk
|
|
if-no-files-found: error
|
|
retention-days: 7
|