Skip to content

Use Gradle-generated APK names and simplify workflow - #15

Merged
CircuitCoder merged 58 commits into
masterfrom
copilot/add-signing-steps-to-build
Feb 19, 2026
Merged

Use Gradle-generated APK names and simplify workflow#15
CircuitCoder merged 58 commits into
masterfrom
copilot/add-signing-steps-to-build

Conversation

Copilot AI commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

The workflow has been simplified to use Gradle's automatic APK naming instead of post-build renaming. Gradle now handles version embedding in filenames, eliminating the need for version extraction and external rename scripts.

Changes

Gradle APK naming

  • APKs are automatically named by Gradle: kqt-{abi}-{versionName}-{buildType}.apk
  • Configuration in build.gradle.kts sets output filenames during build

Simplified workflow

  • Removed version extraction step (no longer needed with Gradle naming)
  • Removed rename-apks.sh script and its invocations
  • Added "Collect and rename APKs" step that:
    • Copies built APKs to apk-collection/ directory
    • Appends commit hash to each filename
    • Appends -UNSIGNED suffix for unsigned builds (PRs)
  • Upload step now uses single collection directory

Optional signing

  • Signing is optional based on KEYSTORE_PASSWORD availability
  • PRs build successfully with unsigned APKs clearly marked
  • Password is trimmed to handle whitespace in secrets

APK Naming Examples

Signed builds:

  • kqt-arm64-v8a-1.0-debug-abc123.apk
  • kqt-armeabi-v7a-1.0-release-abc123.apk
  • kqt-universal-1.0-debug-abc123.apk

Unsigned builds (PRs):

  • kqt-arm64-v8a-1.0-debug-abc123-UNSIGNED.apk
  • kqt-universal-1.0-release-abc123-UNSIGNED.apk

Implementation

# Collect APKs with commit hash
for apk in android/app/build/outputs/apk/debug/kqt-*.apk; do
  filename=$(basename "$apk")
  new_name="${filename%.apk}-${COMMIT_HASH}${SUFFIX}.apk"
  cp "$apk" "apk-collection/$new_name"
done

The workflow is now significantly simpler with fewer steps, no external scripts, and direct use of Gradle's built-in naming capabilities.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 10, 2026 15:55
…#12)

* Initial plan

* Update Android build flow to use kqt-kotlin package

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Update Android build flow to use new android directory at root

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Re-enable Android build workflow with new /android directory

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Add multi-ABI support and split APK configuration

- Add armeabi-v7a target alongside arm64-v8a
- Build native libraries for both ABIs separately
- Generate uniffi bindings once using arm64-v8a library
- Configure gradle for split APKs per ABI and universal APK
- Update artifact names to reflect multiple APKs

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Copilot AI and others added 13 commits February 15, 2026 15:43
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
…idity period

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
…idity period

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Copilot AI changed the title [WIP] Add signing steps to Android build workflow Add APK signing to Android build workflow Feb 15, 2026
Copilot AI requested a review from CircuitCoder February 15, 2026 15:50
@CircuitCoder

Copy link
Copy Markdown
Owner

@copilot Please make the following modifications:

  1. Please make sure that in your SIGNING.md document, the keystore is generated as an encrypted on-disk format. Since it's password encrypted, and only a debug signing keystore, we'll elect to commit it directly into git.
  2. As explained before, please use android/app/keys/ci.keystore as signing keystore for CIs. The key alias is apk, it didn't require a key password. So that only leave one CI secrets: KEYSTORE_PASSWORD.
  3. We'll be using ECDSA. Please make sure that the workflow works with that.
  4. Please separately upload two apks, don't zip them together. Name the apks kqt-[debug/release]-[abi]-[VERSION]-[COMMIT].apk.

Copilot AI and others added 6 commits February 18, 2026 08:38
… APK uploads

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
… APK uploads

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

Copilot AI commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Now the building completes, but the "Get version name" step fails with "Process completed with exit code 1.", but no gradle outputs are produced. The full output of the step is provided below...

Fixed in commit 78a209a. The issue was that the "Get version name" step wasn't passing the KEYSTORE_PASSWORD environment variable, which is needed during Gradle configuration phase. Added the env var and improved error handling to capture both stdout and stderr, making it easier to diagnose any future issues.

Copilot AI and others added 4 commits February 18, 2026 10:15
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Copilot AI changed the title Sign debug builds, consolidate artifact uploads, and support unsigned builds in PRs Extract version from built APK instead of re-running Gradle Feb 18, 2026
@CircuitCoder

Copy link
Copy Markdown
Owner

@copilot We've moved the version name extraction into gradle. Now the apk will be directly named as kqt---<debug|release>.apk. Please modify and simplify the workflow and renaming script, so that we only need to:

  • Recursively find apks in a subdirectory. Can be done with a simple find | grep pipe.
  • On found apks, append commit hash at the end, and collect them into a directory. This is also a oneliner in bash, you can extract the basename without extension, and prepend it onto .apk, that would form your cp destination.
  • The upload step can now upload from the collected directory.

Please verify that the changed gradle config works as intended, and do the above modifications.

Copilot AI and others added 3 commits February 18, 2026 19:35
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

Copilot AI commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot We've moved the version name extraction into gradle. Now the apk will be directly named as kqt---<debug|release>.apk. Please modify and simplify the workflow and renaming script...

Done! Implemented in commits 2ae4e7d, 3d8ae81, and 48843ae:

  1. ✅ Removed version extraction step (Gradle now handles APK naming)
  2. ✅ Created "Collect and rename APKs" step that copies APKs from build directories to apk-collection/ with commit hash appended
  3. ✅ Upload step now uses the collection directory: apk-collection/*.apk
  4. ✅ Removed obsolete rename-apks.sh script

The workflow now uses Gradle-generated names (kqt-{abi}-{version}-{buildType}.apk) and appends the commit hash during collection, producing final names like kqt-arm64-v8a-1.0-debug-abc123.apk.

Copilot AI changed the title Extract version from built APK instead of re-running Gradle Use Gradle-generated APK names and simplify workflow Feb 18, 2026
@CircuitCoder
CircuitCoder force-pushed the copilot/add-signing-steps-to-build branch from 3e08e98 to 445cc52 Compare February 18, 2026 21:46
@CircuitCoder
CircuitCoder merged commit a577720 into master Feb 19, 2026
9 checks passed
CircuitCoder added a commit that referenced this pull request Feb 20, 2026
* Add multi-ABI support with split APK configuration for Android builds (#12)

* Initial plan

* Update Android build flow to use kqt-kotlin package

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Update Android build flow to use new android directory at root

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Re-enable Android build workflow with new /android directory

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Add multi-ABI support and split APK configuration

- Add armeabi-v7a target alongside arm64-v8a
- Build native libraries for both ABIs separately
- Generate uniffi bindings once using arm64-v8a library
- Configure gradle for split APKs per ABI and universal APK
- Update artifact names to reflect multiple APKs

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Initial plan

* Add APK signing configuration to Android build workflow

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Add APK signing configuration to Android build workflow

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Address code review feedback: use GITHUB_WORKSPACE and improve security

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Address code review feedback: use GITHUB_WORKSPACE and improve security

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Fix signing configuration to gracefully handle missing credentials

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Fix signing configuration to gracefully handle missing credentials

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Refactor signing configuration to avoid code duplication

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Refactor signing configuration to avoid code duplication

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Fix documentation: use genkeypair instead of deprecated genkey

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Fix documentation: use genkeypair instead of deprecated genkey

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Add keystore cleanup step to prevent sensitive data leakage

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Improve security: set restrictive keystore permissions and reduce validity period

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Improve security: set restrictive keystore permissions and reduce validity period

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Refactor signing to use committed CI keystore with ECDSA and separate APK uploads

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Refactor signing to use committed CI keystore with ECDSA and separate APK uploads

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Address code review: improve error handling and reduce duplication

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Address code review: improve error handling and reduce duplication

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Fix Gradle properties command and improve script robustness

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Fix Gradle properties command and improve script robustness

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Improve documentation accuracy and script error handling

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Improve documentation accuracy and script error handling

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Final polish: validate version extraction and warn on unexpected APKs

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Final polish: validate version extraction and warn on unexpected APKs

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Add better error handling for edge cases

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Fix APK rename script to use continue statements

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Sign debug builds, simplify uploads, and improve keystore documentation

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Sign debug builds, simplify uploads, and improve keystore documentation

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Add: ci.keystore

* Add: ci.keystore

* Make signing optional and mark unsigned APKs in filename

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Make signing optional and mark unsigned APKs in filename

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Optimize build.gradle.kts to avoid redundant environment variable checks

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Optimize build.gradle.kts to avoid redundant environment variable checks

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Fix signing detection in PRs and improve shell script conventions

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Trim keystore password to handle whitespace in secrets

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Trim keystore password to handle whitespace in secrets

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Add better error handling and debugging to version extraction step

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Extract version from built APK instead of running Gradle properties

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Use wildcard pattern to find universal APK for version extraction

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Add better error handling for aapt command

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Clarify why we use debug APK for version extraction

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Changed APK naming

* Use Gradle-generated APK names and collect with commit hash

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Remove obsolete rename-apks.sh script

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Quote shell variable assignments for safety

Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>

* Modify gradle config again

* Updated workflow to match gradle build output

* Manually run collection task

* Fixing collection task

* Changed APK regex

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: CircuitCoder <2051572+CircuitCoder@users.noreply.github.com>
Co-authored-by: Liu Xiaoyi <circuitcoder0@gmail.com>
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.

2 participants