Skip to content

[Feature]: Config-driven Android signing without regenerating gen/android in CI #282

Description

@thwbh

Category

New Feature

Target Platform

Android

Feature Description

Add config-driven Android signing so the keystore/signing setup no longer requires hand-editing the generated gen/android/app/build.gradle.kts or running a separate template-application script in CI.

Today the Android signing config lives only in the Tauri-generated Gradle file. Because gen/ is gitignored by default, CI must run cargo tauri android init, which regenerates a stock build.gradle.kts without our signing config — so we re-apply it via src-tauri/android-templates/setup-android.sh and generate keystore.properties from CI env vars. This is brittle: init aborts/overwrites against an existing gen/android, and every regeneration risks losing customizations.

Proposed Solution / Mockup

Two complementary tracks (this issue tracks our own repo's adoption; the upstream piece is noted under Alternatives):

1. Commit gen/android and read signing from env vars in a committed build.gradle.kts.

Un-gitignore gen/android (keeping its nested artifact .gitignores), commit a signing-aware build.gradle.kts, and have CI just set env vars + run tauri android build — no init, no setup-android.sh:

signingConfigs {
    create("release") {
        System.getenv("KEYSTORE_FILE")?.let {
            storeFile = file(it)
            storePassword = System.getenv("KEYSTORE_PASSWORD")
            keyAlias = System.getenv("KEY_ALIAS")
            keyPassword = System.getenv("KEY_PASSWORD")
        }
    }
}

Outcome: CI checks out the repo (project already present) and runs the build. The only dynamic step left is decoding the keystore secret to a file + exporting env vars — intrinsic to signing, not project glue. Keystore file and passwords stay out of git.

2. (Stretch) Drop the init call from the CD workflow once gen/android is committed, and reduce setup-android.sh to nothing (or the keystore-from-secret decode only).

Problem Statement (Optional)

The current signing flow is the most fragile part of the Android build. cargo tauri android init is required in CD only because gen/ is gitignored; that forces regeneration, which wipes signing config and fights any existing gen/android folder. This has caused repeated CD breakage.

Alternatives Considered (Optional)

  • Upstream contribution: add an android.signing block to tauri.conf.json that the Tauri CLI wires into Gradle signingConfigs. This removes the manual Gradle edit for everyone, but must be a PR to tauri-apps/tauri (the CLI owns config parsing + Gradle codegen) — not something we can ship as a standalone crate. Worth floating upstream as an RFC.
  • Standalone shim crate: a cargo install-able pre-build tool that patches gen/android before the build. Rejected as the preferred path — it's the same category as the current shell script, just nicer; it productizes the workaround instead of removing it.
  • tauri android init -f: still regenerates and loses customizations; not a fix.

Additional Context (Optional)

Relevant files: src-tauri/android-templates/setup-android.sh, src-tauri/gen/android/app/build.gradle.kts (generated), .github CD workflow. Tauri docs confirm gen/ is meant to be committable (Tauri discussion #8323), and that signing currently requires editing the generated build.gradle.kts (Tauri Android Code Signing docs).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

devopsDevOps relatedenhancementNew feature or requestreview requiredIssue has not been assigned yettarget:androidBug/Feature is targeted towards the Android release

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions