Skip to content

Conversation

@matejsemancik
Copy link
Member

@matejsemancik matejsemancik commented Sep 24, 2025

Intro

This PR refactors GitHub Actions workflows by introducing 6 reusable composite actions for Android and KMP projects, eliminating code duplication and improving maintainability. The changes consolidate common CI/CD patterns into modular components, enhance caching mechanisms, and add two new nightly build
workflows for automated Android and cross-platform KMP deployments.

Key Features

  • New Composite Actions: Created 6 reusable actions for Android/KMP workflows:
    • android-setup-environment - Java, Gradle, and Ruby setup
    • android-check - Lint checks and unit tests with Danger integration
    • android-build-firebase - Enterprise builds with Firebase App Distribution
    • android-build-googlePlay - Release builds for Google Play Store
    • android-generate-baseline-profiles - Automated baseline profile generation
    • ios-kmp-build - iOS/KMP builds with TestFlight upload
    • kmp-detect-changes - Platform-specific change detection
  • New Nightly Build Workflows:
    • android-cloud-nightly-build.yml - Automated Android enterprise builds with changelog generation
    • kmp-combined-nightly-build.yml - Automated nightly builds for both iOS and Android with with changelog generation
  • Workflow Modernization: Refactored 7 existing workflows to use composite actions, reducing code duplication by ~75%
  • Enhanced Caching for changelog action: Improved cache key generation with workflow and branch-specific keys for better cache hit rates

Breaking Changes

This guide outlines the necessary changes for existing users integrating with the updated Android workflows.

Summary of Changes

Firebase App Distribution Workflow

  • Change: BUNDLE_GRADLE_TASKPACKAGE_GRADLE_TASK
  • Remove: SIGNING_KEYSTORE_PATH input
  • Remove: All signing secrets (SIGNING_KEYSTORE_PASSWORD, SIGNING_KEY_ALIAS, SIGNING_KEY_PASSWORD)

Google Play Workflow

  • Remove: SIGNING_KEYSTORE_PATH input (was unused)
  • Keep: All signing secrets (still required)

Detailed guides

Firebase App Distribution Workflow Changes

Required Input Changes

1. Rename BUNDLE_GRADLE_TASK to PACKAGE_GRADLE_TASK

Before:

uses: futuredapp/.github/.github/workflows/android-cloud-release-firebaseAppDistribution.yml@main
with:
  BUNDLE_GRADLE_TASK: "bundleEnterprise"

After:

uses: futuredapp/.github/.github/workflows/android-cloud-release-firebaseAppDistribution.yml@main
with:
  PACKAGE_GRADLE_TASK: "packageEnterpriseUniversalApk"

Note: The new task should be a Gradle task for packaging universal APK (e.g., packageEnterpriseUniversalApk or packageDevEnterpriseUniversalApk) instead of a bundle task. This packaging task is a built-in task in Android Gradle Plugin (AGP) and should match the build variant and flavor you want to build.

2. Remove SIGNING_KEYSTORE_PATH Input

Before:

uses: futuredapp/.github/.github/workflows/android-cloud-release-firebaseAppDistribution.yml@main
with:
  SIGNING_KEYSTORE_PATH: "keystore/debug.jks"
  # other inputs...

After:

uses: futuredapp/.github/.github/workflows/android-cloud-release-firebaseAppDistribution.yml@main
with:
  # SIGNING_KEYSTORE_PATH removed
  # other inputs...

Required Secret Changes

Remove All Signing Secrets

The following secrets are no longer required and should be removed from your workflow calls:

Remove these secrets:

  • SIGNING_KEYSTORE_PASSWORD
  • SIGNING_KEY_ALIAS
  • SIGNING_KEY_PASSWORD

Before:

secrets:
  SIGNING_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
  SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
  SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
  APP_DISTRIBUTION_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}

After:

secrets:
  APP_DISTRIBUTION_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}

Complete Migration Example

Before:

jobs:
  deploy-firebase:
    uses: futuredapp/.github/.github/workflows/android-cloud-release-firebaseAppDistribution.yml@main
    with:
      TEST_GRADLE_TASKS: "testReleaseUnitTest"
      BUNDLE_GRADLE_TASK: "bundleEnterprise"
      UPLOAD_GRADLE_TASK: "appDistributionUploadEnterprise"
      SIGNING_KEYSTORE_PATH: "keystore/release.jks"
      APP_DISTRIBUTION_GROUPS: "qa-team,beta-testers"
    secrets:
      SIGNING_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
      SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
      SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
      APP_DISTRIBUTION_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}

After:

jobs:
  deploy-firebase:
    uses: futuredapp/.github/.github/workflows/android-cloud-release-firebaseAppDistribution.yml@main
    with:
      TEST_GRADLE_TASKS: "testReleaseUnitTest"
      PACKAGE_GRADLE_TASK: "packageEnterpriseUniversalApk"
      UPLOAD_GRADLE_TASK: "appDistributionUploadEnterprise"
      APP_DISTRIBUTION_GROUPS: "qa-team,beta-testers"
    secrets:
      APP_DISTRIBUTION_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
Google Play Workflow Changes

Required Input Changes

Remove SIGNING_KEYSTORE_PATH Input

Before:

uses: futuredapp/.github/.github/workflows/android-cloud-release-googlePlay.yml@main
with:
  SIGNING_KEYSTORE_PATH: "keystore/release.jks"
  # other inputs...

After:

uses: futuredapp/.github/.github/workflows/android-cloud-release-googlePlay.yml@main
with:
  # SIGNING_KEYSTORE_PATH removed
  # other inputs...

Complete Migration Example

Before:

jobs:
  deploy-google-play:
    uses: futuredapp/.github/.github/workflows/android-cloud-release-googlePlay.yml@main
    with:
      VERSION_NAME: "1.0.0"
      BUNDLE_GRADLE_TASK: "bundleRelease"
      SIGNING_KEYSTORE_PATH: "keystore/release.jks"
      GOOGLE_PLAY_APPLICATION_ID: "com.example.app"
      GOOGLE_PLAY_WHATSNEW_DIRECTORY: "distribution/whatsnew"
    secrets:
      SIGNING_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
      SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
      SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
      GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}

After:

jobs:
  deploy-google-play:
    uses: futuredapp/.github/.github/workflows/android-cloud-release-googlePlay.yml@main
    with:
      VERSION_NAME: "1.0.0"
      BUNDLE_GRADLE_TASK: "bundleRelease"
      GOOGLE_PLAY_APPLICATION_ID: "com.example.app"
      GOOGLE_PLAY_WHATSNEW_DIRECTORY: "distribution/whatsnew"
    secrets:
      SIGNING_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
      SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
      SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
      GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}

Technical Background

Firebase App Distribution Changes

The underlying logic no longer uses bundletool to create and sign universal APKs. Instead, the workflow now uses the built-in Android Gradle Plugin task for packaging universal APKs, which eliminates the need for external keystore handling and signing configuration.

Google Play Changes

The SIGNING_KEYSTORE_PATH input was unused and has been removed for consistency and clarity.

Encapsulates the logic for detecting KMP project changes into a dedicated GitHub Action, improving modularity and reusability across workflows.
Ensures unique cache keys per workflow and branch to prevent collisions and improve caching reliability.
This commit introduces new composite GitHub Actions for Android projects to standardize CI/CD workflows. These actions include building for Firebase App Distribution, building for Google Play, running lint and unit tests, and setting up the Android environment.
The `bundle_file` output was incorrectly set to the literal string "BUNDLE_FILE" instead of the variable's value due to a missing dollar sign for variable expansion. This commit fixes the issue.
Encapsulate environment setup and check execution into reusable GitHub Actions.
Ensure local GitHub Actions are referenced with explicit relative paths to prevent resolution issues.
Reference `android-setup-environment` and `android-check` from `futuredapp/.github`'s `feature/matsem/changelog-android` branch.
…ken`

Replace `secrets.GITHUB_TOKEN` with the recommended `github.token` for better readability and consistency.
…te actions

Replace inline steps with reusable `android-setup-environment` and `android-build-googlePlay` composite actions from `futuredapp/.github`. Add TODOs to update branch references to `main`.
This workflow automates nightly builds for Android projects, including changelog generation and Firebase App Distribution. The `package_gradle_task` in `android-build-firebase` action is updated to require explicit definition.
Introduces caching of the last successfully built commit's SHA to optimize subsequent nightly builds.
Ensure the commit SHA of the latest nightly build is explicitly saved to a file for tracking and caching.
Encapsulate build and upload logic into reusable GitHub Actions for better maintainability and reusability.
The existing workflow for generating Android baseline profiles was refactored to extract the core logic into a dedicated, reusable GitHub Action. This improves modularity and simplifies the workflow definition. The workflow file was also renamed to reflect its cloud context.
Added entries for nightly build and baseline profile generation workflows.
…Gradle properties

Updated Firebase and Google Play build workflows to pass build variables as Gradle properties. This resolves an issue with sticky build variables when using configuration cache.
…or` actions

Replaced references to `feature/matsem/changelog-android` with `feature/android-refactor` across workflows for consistency and improved maintainability.
…rets as Gradle properties"

This reverts commit eae0553.
… workflow

Introduced a new `ios-build` reusable action to streamline iOS builds and uploads to TestFlight. Updated `ios-kmp-selfhosted-build.yml` to integrate the new action and added a nightly build workflow for improved automation.
…n Android CI action

Introduced inputs to enable or disable the setup of Java, Ruby, and Gradle independently in `.github/actions/android-setup-environment`. Updated steps to conditionally execute based on these inputs for enhanced flexibility.
Ruby is already installed on runner
This workflow automates nightly builds for KMP projects, including Android and iOS, changelog generation, and build caching.
Adds a new workflow to the table and introduces a Mermaid diagram to visualize workflow and action dependencies for better understanding.
- Added `workflows-lint` and `kmp-combined-nightly-build` workflows to the table.
- Fixed formatting inconsistency for `iOS (KMP)` workflow entry.
…kflow

- Removed redundant input definitions for `ios_secret_properties` and modified references to use `secrets`.
- Adjusted formatting and cleaned up unnecessary lines for better readability.
@matejsemancik matejsemancik changed the title Android nightly builds + refactor to composite actions AN + KMP nightly builds, refactor to composite actions Sep 26, 2025
@matejsemancik matejsemancik changed the title AN + KMP nightly builds, refactor to composite actions AN + KMP nightly builds, refactor to reusable composite actions Sep 26, 2025
…enerate-baseline-profiles`

- Ensures consistency and avoids potential shell mismatches across defined steps.
- Temporarily point to `feature/android-refactor` branch with a TODO note to update to `main`.
- Replaced `feature/android-refactor` branch references with `main`.
- Removed outdated TODO comments regarding branch updates.
- Replaced `ios-build` action with `ios-kmp-build` in KMP workflows for consistency.
…tly-build.yml`

- Updated all input and secret variable names to use uppercase casing for consistency.
- Adjusted workflow references to align with new variable names.
@matejsemancik matejsemancik marked this pull request as ready for review September 26, 2025 12:28
@matejsemancik matejsemancik merged commit f23e660 into main Oct 7, 2025
1 check passed
@matejsemancik matejsemancik deleted the feature/android-refactor branch October 7, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants