diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 23e3661..9f2aa88 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -38,7 +38,7 @@ jobs: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore/trmnl-app-release.keystore - name: Build Release APK - run: ./gradlew assembleStandardRelease + run: ./gradlew assembleRelease env: KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} KEY_ALIAS: ${{ secrets.KEY_ALIAS }} @@ -53,7 +53,7 @@ jobs: - name: Rename APK run: | mkdir -p artifact - cp app/build/outputs/apk/standard/release/app-standard-release.apk artifact/trmnl-mirror-v${{ steps.version.outputs.VERSION }}.apk + cp app/build/outputs/apk/release/app-release.apk artifact/trmnl-mirror-v${{ steps.version.outputs.VERSION }}.apk - name: Upload Release APK uses: actions/upload-artifact@v4 diff --git a/.github/workflows/fdroid-build.yml b/.github/workflows/fdroid-build.yml deleted file mode 100644 index 74a277d..0000000 --- a/.github/workflows/fdroid-build.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: F-Droid Build - -# Builds a signed F-Droid APK using the production keystore. -# F-Droid will verify the signature during their reproducible build process. - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - # This allows manual triggering of the workflow, which results in making a signed F-Droid APK build - # Go to the "Actions" tab the repository, select this workflow, and click the "Run workflow" button to run it manually. - workflow_dispatch: - -jobs: - build-fdroid: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - java-version: '23' - distribution: 'temurin' - cache: gradle - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - - - name: Decode keystore from base64 - run: | - echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore/trmnl-app-release.keystore - - - name: Build F-Droid APK - run: ./gradlew buildFDroid - env: - KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} - KEY_ALIAS: ${{ secrets.KEY_ALIAS }} - - - name: Extract version name - id: version - run: | - VERSION_NAME=$(grep -o 'versionName = "[^"]*"' app/build.gradle.kts | cut -d'"' -f2) - echo "VERSION=$VERSION_NAME" >> $GITHUB_OUTPUT - echo "App version name extracted: $VERSION_NAME" - - - name: Rename APK - run: | - mkdir -p artifact - cp app/build/outputs/apk/fdroid/release/app-fdroid-release.apk artifact/trmnl-mirror-fdroid-v${{ steps.version.outputs.VERSION }}.apk - - - name: Upload F-Droid APK - uses: actions/upload-artifact@v4 - with: - name: trmnl-mirror-fdroid-signed - path: artifact/trmnl-mirror-fdroid-v${{ steps.version.outputs.VERSION }}.apk - # Use maximum allowed retention period - # https://github.com/actions/upload-artifact?tab=readme-ov-file#retention-period - retention-days: 90 diff --git a/BUILD_FDROID.md b/BUILD_FDROID.md deleted file mode 100644 index 4eda97e..0000000 --- a/BUILD_FDROID.md +++ /dev/null @@ -1,63 +0,0 @@ -# Building for F-Droid - -This document outlines the steps required to build the TRMNL Display Mirror app for F-Droid submission. - -## F-Droid Specific Build Configuration - -The app includes specific configurations for F-Droid compatibility: - -1. A dedicated `fdroid` product flavor that excludes Google Fonts -2. A specific `fdroidRelease` build type -3. System fonts are used instead of Google Fonts for the F-Droid version -4. The F-Droid build is **signed** with the production keystore for consistency across all distribution channels - -## Building the F-Droid Version - -To build the F-Droid version locally: - -```bash -./gradlew assembleFdroidRelease -``` - -This will generate a signed APK in `app/build/outputs/apk/fdroid/release/` using the production keystore. The F-Droid build variant now uses the same signing configuration as the standard release build, ensuring consistency across all distribution channels. - -> **Note**: F-Droid's reproducible build process will verify that the APK can be rebuilt with the same signature, ensuring the integrity of the build process. - -Alternatively, you can use the convenience task: - -```bash -./gradlew buildFDroid -``` - -## F-Droid Metadata - -The F-Droid specific metadata is located in: -- `fastlane/metadata/android/en-US/` - Contains descriptions, changelogs and screenshots -- `metadata/` - Contains F-Droid specific YAML configuration - -## Dependencies - -The F-Droid build variant avoids the following proprietary dependencies: -- Google Fonts (replaced with system fonts) - -## Testing the F-Droid Build - -After building the F-Droid variant, verify that: -1. The app installs and runs correctly -2. All functionality works without Google dependencies -3. The UI appears correctly with system fonts - -## Submitting to F-Droid - -The app can be submitted to F-Droid through: - -1. The [F-Droid submission form](https://gitlab.com/fdroid/fdroiddata/-/issues/new?issuable_template=App_Submission) -2. A merge request to the F-Droid data repository - -Ensure the following are available: -- Source code is publicly accessible on GitHub: https://github.com/usetrmnl/trmnl-android -- The app is licensed under the MIT license -- F-Droid metadata is complete -- The app builds successfully with the F-Droid build system - -Note that F-Droid will build and sign the app themselves using their own signing key. Our build process intentionally does not include a signing configuration for the F-Droid variant (as implemented in [PR #106](https://github.com/usetrmnl/trmnl-android/pull/106)). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index abed5de..207b594 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,18 +78,11 @@ The app supports multiple build variants: To build specific variants: ```bash -# Build the standard release variant -./gradlew buildStandard - -# Build the F-Droid release variant -./gradlew buildFDroid - -# Build all variants -./gradlew buildAllFlavors +# Build the release variant +./gradlew assembleRelease ``` -For more details on the F-Droid build process, see [BUILD_FDROID.md](BUILD_FDROID.md). This document provides guidelines and instructions to help you contribute effectively. - +This command builds a single, signed APK that works both locally (with debug keystore fallback) and in CI (with production keystore). ### Release Process diff --git a/RELEASE_CHECKLIST.md b/RELEASE_CHECKLIST.md index daa0604..3389ae7 100644 --- a/RELEASE_CHECKLIST.md +++ b/RELEASE_CHECKLIST.md @@ -55,8 +55,8 @@ After the version management workflow has completed: 2. **Verify the build works with the new version**: ```bash - # Build both variants to ensure they work - ./gradlew buildStandard buildFDroid + # Build release variant to ensure it works + ./gradlew assembleRelease ``` 3. **Create a GitHub release**: @@ -64,7 +64,7 @@ After the version management workflow has completed: - Select the tag created by the workflow - Title: "TRMNL Android v{VERSION_NAME}" - Description: Copy content from the changelog file - - Attach the built APKs + - Attach the built APK ## Troubleshooting diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 62fca33..1d94d9d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -71,6 +71,16 @@ android { getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro", ) + + // Sign release builds with production keystore in CI, fallback to debug keystore locally + signingConfig = if (signingConfigs.getByName("release").storeFile?.exists() == true && + signingConfigs.getByName("release").storePassword != null && + signingConfigs.getByName("release").keyAlias != null) { + signingConfigs.getByName("release") + } else { + println("âš ī¸ Production keystore not available, falling back to debug keystore for release build") + signingConfigs.getByName("debug") + } } debug { @@ -82,30 +92,6 @@ android { } } - // Add product flavors for F-Droid compatibility - flavorDimensions += "store" - productFlavors { - create("standard") { - dimension = "store" - // Standard flavor with all features - buildConfigField("Boolean", "FDROID_BUILD", "false") - - // Apply signing only for standard flavor - signingConfig = signingConfigs.getByName("release") - } - - create("fdroid") { - dimension = "store" - // F-Droid specific configuration - // No non-free dependencies - buildConfigField("Boolean", "FDROID_BUILD", "true") - - // â„šī¸ Also sign the F-Droid build with the release keystore - // F-Droid will use reproducible builds process to validate authenticity - signingConfig = signingConfigs.getByName("release") - } - } - compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/app/src/fdroid/.keep b/app/src/fdroid/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/src/fdroid/README.md b/app/src/fdroid/README.md deleted file mode 100644 index ba13471..0000000 --- a/app/src/fdroid/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## F-Droid Variant -This variant is for building the app for F-Droid, an open-source app store for Android. -It is designed to be built with the `fdroid` flavor. - -Right now there is no difference between the `fdroid` and `standard` flavors, but this may change in the future. \ No newline at end of file diff --git a/app/src/fdroid/java/ink/trmnl/android/.keep b/app/src/fdroid/java/ink/trmnl/android/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/src/fdroid/java/ink/trmnl/android/ui/theme/FdroidTypographyHelper.kt b/app/src/fdroid/java/ink/trmnl/android/ui/theme/FdroidTypographyHelper.kt deleted file mode 100644 index 652d439..0000000 --- a/app/src/fdroid/java/ink/trmnl/android/ui/theme/FdroidTypographyHelper.kt +++ /dev/null @@ -1,9 +0,0 @@ -package ink.trmnl.android.ui.theme - -/** - * F-Droid build variant no longer needs special handling for typography - * since we're now bundling the fonts directly in the app package. - */ -object FdroidTypographyHelper { - // Empty helper class preserved for compatibility -} diff --git a/build.gradle.kts b/build.gradle.kts index e9e5307..ff755f5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,35 +29,3 @@ plugins { // Also see: https://github.com/ZacSweers/anvil/blob/main/FORK.md alias(libs.plugins.anvil) apply false } - -// Task to build F-Droid APK -tasks.register("buildFDroid") { - description = "Builds the F-Droid APK variant" - dependsOn(":app:assembleFdroidRelease") - - doLast { - println("F-Droid APK built successfully at: app/build/outputs/apk/fdroid/release/") - } -} - -// Task to build standard APK for GitHub workflows -tasks.register("buildStandard") { - description = "Builds the standard APK variant" - dependsOn(":app:assembleStandardRelease") - - doLast { - println("Standard APK built successfully at: app/build/outputs/apk/standard/release/") - } -} - -// Task to verify all flavors build correctly -tasks.register("buildAllFlavors") { - description = "Builds all flavor variants (Standard and F-Droid)" - dependsOn("buildStandard", "buildFDroid") - - doLast { - println("All flavor variants built successfully") - println("Standard APK: app/build/outputs/apk/standard/release/") - println("F-Droid APK: app/build/outputs/apk/fdroid/release/") - } -} diff --git a/keystore/README.md b/keystore/README.md index fad65cb..2ef948f 100644 --- a/keystore/README.md +++ b/keystore/README.md @@ -40,10 +40,9 @@ The following GitHub Actions secrets are required: ### CI/CD Workflows Using Production Keystore -- **`android-release.yml`**: Builds and signs standard release APKs -- **`fdroid-build.yml`**: Builds and signs F-Droid release APKs +- **`android-release.yml`**: Builds and signs release APKs using the production keystore in CI, with debug keystore fallback for local builds -Both workflows decode the keystore from the base64 secret and provide the necessary environment variables for signing. +The workflow decodes the keystore from the base64 secret and provides the necessary environment variables for signing. ## Related Resources - https://developer.android.com/studio/publish/app-signing diff --git a/scripts/show_version_info.sh b/scripts/show_version_info.sh index 970ffbe..76df503 100755 --- a/scripts/show_version_info.sh +++ b/scripts/show_version_info.sh @@ -19,15 +19,15 @@ echo " - Version Code: $VERSION_CODE" echo " - Version Name: $VERSION_NAME" echo -# Extract version from F-Droid metadata +# Extract version from metadata (optional) if [ -f "$ROOT_DIR/metadata/ink.trmnl.android.yml" ]; then - echo "🤖 From F-Droid metadata:" - FDROID_VERSION=$(grep -o 'CurrentVersion: .*' "$ROOT_DIR/metadata/ink.trmnl.android.yml" | awk '{print $2}') - FDROID_CODE=$(grep -o 'CurrentVersionCode: [0-9]*' "$ROOT_DIR/metadata/ink.trmnl.android.yml" | awk '{print $2}') - FDROID_TAG=$(grep -o 'commit: .*' "$ROOT_DIR/metadata/ink.trmnl.android.yml" | awk '{print $2}') - echo " - Version Code: $FDROID_CODE" - echo " - Version Name: $FDROID_VERSION" - echo " - Git Tag: $FDROID_TAG" + echo "📄 From metadata/ink.trmnl.android.yml:" + METADATA_VERSION=$(grep -o 'CurrentVersion: .*' "$ROOT_DIR/metadata/ink.trmnl.android.yml" | awk '{print $2}' || echo "N/A") + METADATA_CODE=$(grep -o 'CurrentVersionCode: [0-9]*' "$ROOT_DIR/metadata/ink.trmnl.android.yml" | awk '{print $2}' || echo "N/A") + METADATA_TAG=$(grep -o 'commit: .*' "$ROOT_DIR/metadata/ink.trmnl.android.yml" | awk '{print $2}' || echo "N/A") + echo " - Version Code: $METADATA_CODE" + echo " - Version Name: $METADATA_VERSION" + echo " - Git Tag: $METADATA_TAG" echo fi