Apply Gradle Play Publisher 3.13.0 to the Android target, target the internal track with AUTO version codes, and add a tag-only CI job that decodes the upload keystore and uploads with the service account JSON from repository secrets. Document the one-time service account and secret setup.
120 lines
4.1 KiB
YAML
120 lines
4.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
|
|
env:
|
|
# Built by scripts/build-ci-image.sh from ci/Dockerfile.
|
|
CI_IMAGE: gitea.tap-tap.win/taptap/audiomanager-client-ci:3
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
container:
|
|
image: gitea.tap-tap.win/taptap/audiomanager-client-ci:3
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# The app targets API 36, which Play requires for new uploads. The CI
|
|
# image still ships API 35, so install 36 on demand until it is rebuilt.
|
|
- name: Ensure Android SDK 36
|
|
run: |
|
|
set -euo pipefail
|
|
if [ ! -d "$ANDROID_HOME/platforms/android-36" ]; then
|
|
# stdin is already covered by the image's accepted licenses; do not
|
|
# pipe `yes` here, it dies with SIGPIPE and fails under pipefail.
|
|
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install \
|
|
"platforms;android-36" "build-tools;36.0.0" </dev/null >/dev/null
|
|
fi
|
|
|
|
- name: Test and build
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
gradle \
|
|
:composeApp:desktopTest \
|
|
:composeApp:assembleDebug \
|
|
:composeApp:packageUberJarForCurrentOS \
|
|
:composeApp:wasmJsBrowserDistribution \
|
|
--console=plain
|
|
else
|
|
# The optimized Wasm build is CPU-bound and slow; main/PR builds
|
|
# only need to prove the web target compiles and bundles.
|
|
gradle \
|
|
:composeApp:desktopTest \
|
|
:composeApp:assembleDebug \
|
|
:composeApp:wasmJsBrowserDevelopmentExecutableDistribution \
|
|
--console=plain
|
|
fi
|
|
|
|
- name: Collect artifacts
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p dist
|
|
cp composeApp/build/outputs/apk/debug/composeApp-debug.apk dist/AudioManager.apk
|
|
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
cp composeApp/build/compose/jars/*.jar dist/AudioManager-desktop.jar
|
|
(cd composeApp/build/dist/wasmJs/productionExecutable && zip -qr "$GITHUB_WORKSPACE/dist/AudioManager-web.zip" .)
|
|
fi
|
|
|
|
- name: Publish release assets
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: scripts/publish-release.sh dist
|
|
|
|
play:
|
|
# Publish tagged builds to the Google Play internal testing track.
|
|
# Requires the repository secrets listed in README.md.
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: [build]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
container:
|
|
image: gitea.tap-tap.win/taptap/audiomanager-client-ci:3
|
|
env:
|
|
ANDROID_KEYSTORE_PATH: /tmp/upload-keystore.jks
|
|
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
# GPP reads the JSON contents from this variable; nothing is written to
|
|
# the repository.
|
|
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Ensure Android SDK 36
|
|
run: |
|
|
set -euo pipefail
|
|
if [ ! -d "$ANDROID_HOME/platforms/android-36" ]; then
|
|
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install \
|
|
"platforms;android-36" "build-tools;36.0.0" </dev/null >/dev/null
|
|
fi
|
|
|
|
- name: Decode the upload keystore
|
|
env:
|
|
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
run: |
|
|
set -euo pipefail
|
|
printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$ANDROID_KEYSTORE_PATH"
|
|
chmod 600 "$ANDROID_KEYSTORE_PATH"
|
|
|
|
- name: Publish to internal testing
|
|
run: |
|
|
set -euo pipefail
|
|
export VERSION_NAME="${GITHUB_REF#refs/tags/v}"
|
|
gradle :composeApp:publishBundle --console=plain
|