build: publish tagged builds to Play internal testing
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.
This commit is contained in:
1 parent
0491c78c7f
commit
d9976a62bd
4 files changed
+90
-5
No files matched your search
@@ -72,3 +72,48 @@ jobs:
|
||||
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
|
||||
@@ -140,12 +140,37 @@ integrity → Google-generated key**, upload the AAB, add release notes, then
|
||||
**Save → Roll out**. The first upload enrolls the app in Play App Signing. Share
|
||||
the opt-in link from the Testers tab with your test list.
|
||||
|
||||
### 4. Automated uploads (later)
|
||||
### 4. Automated uploads
|
||||
|
||||
Create a service account in Google Cloud, enable the **Google Play Android
|
||||
Developer API**, and grant the service account release permissions for this app
|
||||
in Play Console. Then wire Gradle Play Publisher with the service account JSON.
|
||||
The first AAB must still be uploaded manually.
|
||||
Tagged builds (`v*`) publish to internal testing from CI. One-time setup:
|
||||
|
||||
1. In Google Cloud, enable the **Google Play Android Developer API**.
|
||||
2. Create a service account and download a JSON key.
|
||||
3. In Play Console → **Users and permissions → Invite new user**, add the
|
||||
service account's `client_email`, give it access to this app with
|
||||
**Release to testing tracks** and **View app information** (do not grant
|
||||
production or admin access).
|
||||
4. Add these repository secrets in Gitea:
|
||||
|
||||
| Secret | Value |
|
||||
| --- | --- |
|
||||
| `ANDROID_KEYSTORE_BASE64` | `base64 -w0 upload-keystore.jks` |
|
||||
| `ANDROID_KEYSTORE_PASSWORD` | keystore password |
|
||||
| `ANDROID_KEY_ALIAS` | `upload` |
|
||||
| `ANDROID_KEY_PASSWORD` | key password |
|
||||
| `PLAY_SERVICE_ACCOUNT_JSON` | contents of the service account JSON |
|
||||
|
||||
Then `git tag v0.2.0 && git push --tags` builds, signs and uploads the bundle.
|
||||
Gradle Play Publisher asks Play for the next free `versionCode`
|
||||
(`ResolutionStrategy.AUTO`), so only the tag/version name needs to change.
|
||||
|
||||
Local equivalent (takes the JSON from an environment variable, never a file in
|
||||
the repo):
|
||||
|
||||
```bash
|
||||
ANDROID_PUBLISHER_CREDENTIALS="$(cat ~/play-service-account.json)" \
|
||||
ANDROID_HOME=/opt/android-sdk gradle :composeApp:publishBundle
|
||||
```
|
||||
|
||||
## App state and offline behaviour
|
||||
|
||||
|
||||
@@ -4,4 +4,5 @@ plugins {
|
||||
id("org.jetbrains.kotlin.plugin.compose") version "2.1.20" apply false
|
||||
id("org.jetbrains.compose") version "1.8.0" apply false
|
||||
id("com.android.application") version "8.9.1" apply false
|
||||
id("com.github.triplet.play") version "3.13.0" apply false
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
@file:OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
|
||||
|
||||
import java.util.Properties
|
||||
import com.github.triplet.gradle.androidpublisher.ReleaseStatus
|
||||
import com.github.triplet.gradle.androidpublisher.ResolutionStrategy
|
||||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
@@ -10,6 +12,7 @@ plugins {
|
||||
id("org.jetbrains.compose")
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
id("com.android.application")
|
||||
id("com.github.triplet.play")
|
||||
}
|
||||
|
||||
// Release signing and version numbers come from the environment in CI, or from
|
||||
@@ -161,6 +164,17 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
play {
|
||||
// Upload the release AAB to the internal testing track. Credentials are
|
||||
// never committed: CI sets ANDROID_PUBLISHER_CREDENTIALS, and local runs
|
||||
// can use the same variable or PLAY_SERVICE_ACCOUNT_JSON in local.properties.
|
||||
track.set("internal")
|
||||
defaultToAppBundles.set(true)
|
||||
releaseStatus.set(ReleaseStatus.COMPLETED)
|
||||
// Ask Play for the next free version code instead of hand-bumping it.
|
||||
resolutionStrategy.set(ResolutionStrategy.AUTO)
|
||||
}
|
||||
|
||||
compose.desktop {
|
||||
application {
|
||||
mainClass = "win.taptap.musicmanager.client.MainKt"
|
||||
|
||||
Reference in new issue
Block a user