Publish Android releases to a self-hosted F-Droid repo

scripts/fdroid-publish.sh builds a signed arm64 APK and adds it to an
F-Droid repo in a given directory, creating the app signing key and the
repo on first use. The versionCode is the commit count, so any commit can
ship without a manual version bump.

Release builds are signed when src-tauri/gen/android/keystore.properties
exists and stay unsigned otherwise. The manifest picks up the deep-link
plugin's intent filter, which every build regenerates and was never
committed.
This commit is contained in:
2026-10-13 21:20:28 -05:00
parent ece21c1acf
commit 3a72780027
5 changed files with 305 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import java.io.FileInputStream
import java.util.Properties
plugins {
@@ -13,6 +14,15 @@ val tauriProperties = Properties().apply {
}
}
// Release signing key, written by `scripts/fdroid-publish.sh --init-keystore`.
// Without it, release builds come out unsigned as before.
val keystoreProperties = Properties().apply {
val propFile = rootProject.file("keystore.properties")
if (propFile.exists()) {
FileInputStream(propFile).use { load(it) }
}
}
android {
compileSdk = 36
namespace = "com.garrettmills.mtgc"
@@ -24,6 +34,16 @@ android {
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
}
signingConfigs {
if (!keystoreProperties.isEmpty) {
create("release") {
storeFile = file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("password")
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("password")
}
}
}
buildTypes {
getByName("debug") {
manifestPlaceholders["usesCleartextTraffic"] = "true"
@@ -37,6 +57,7 @@ android {
}
}
getByName("release") {
signingConfigs.findByName("release")?.let { signingConfig = it }
isMinifyEnabled = true
proguardFiles(
*fileTree(".") { include("**/*.pro") }

View File

@@ -28,6 +28,21 @@
<!-- AndroidTV support -->
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<!-- DEEP LINK PLUGIN. AUTO-GENERATED. DO NOT REMOVE. -->
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<!-- ChromeOS ARC++ uses a different action for deep links -->
<action android:name="org.chromium.arc.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mtgc" />
<data android:host="auth" />
<data android:path="/callback" />
</intent-filter>
<!-- DEEP LINK PLUGIN. AUTO-GENERATED. DO NOT REMOVE. -->
</activity>
<provider