Skip to content

ci(android): automate GitHub Release on semantic version tags - #21

Merged
Lav-developer merged 1 commit into
android-appfrom
arena/01a09bf5-pyq
Sep 13, 2026
Merged

Lav-developer merged 1 commit into
android-appfrom
arena/01a09bf5-pyq

Conversation

@arena-ai-coding-agent

Copy link
Copy Markdown
Contributor

Summary

Replaces the current manual production release process (download artifact ZIP → extract APK → manually create Release → upload APK) with a fully automated tag-driven pipeline:

version bump → git tag vX.Y.Z → GitHub Actions → tests → signed APK → verification → automatic GitHub Release → direct dsmnru-pyq.apk asset

What this PR does

  • Adds a release job to .github/workflows/android-apk.yml that:
    • triggers only on pushes of semantic version tags matching vMAJOR.MINOR.PATCH (e.g. v1.4.3, v1.5.0, v2.0.0)
    • needs: checks and release-apk — a release can NEVER be created if tests fail or the production APK fails to build
    • has permissions: contents: write (other jobs keep the default read-only)
    • downloads the existing dsmnru-pyq.apk artifact (the APK is not rebuilt; the artifact ZIP is not attached)
    • strictly validates tag format (rejects v1, v1.4, 1.4.3, v1.4.3-beta, arbitrary tags)
    • cross-checks Gradle versionName against the tag version (mismatch fails; developer must bump intentionally)
    • re-verifies the downloaded APK with apksigner verify --print-certs and aapt dump badging:
      • package = com.dsmnru.pyq
      • versionName = tag version
      • versionCode = Gradle versionCode
      • APK is signed
    • fails loudly if signing secrets are missing on a tag push (no silent unsigned release)
    • generates a release body that ALWAYS contains versionCode: N (required by Worker /api/app-update) plus GitHub-generated changelog notes
    • creates the release idempotently: reruns detect an existing release, ensure the body has versionCode, and avoid duplicate APK assets
    • uses the built-in GITHUB_TOKEN (no PAT introduced)
    • never echoes keystore contents, passwords, or base64 secrets to logs
  • Adds android-app/test/release-automation.test.mjs (13 tests) covering tag validation, Gradle/APK metadata parsing, the versionCode: N body contract, compatibility with worker/src/appUpdate.js asset selection, and workflow-file invariants.

What this PR does NOT do

  • Does not create any GitHub Release
  • Does not create or push any git tag
  • Does not bump versionName/versionCode (production baseline stays 1.4.2 / 13)
  • Does not modify updater, update.js, native.js, DsmnruAppPlugin, upload/Gofile/Firestore/Resend flows, Firebase auth, comments, rewards, website, or the main branch
  • Does not change the existing Worker /api/app-update contract — the release body still contains the required versionCode: N line, now generated automatically from the APK

Preserved

  • Existing jobs: checks, debug-apk, release-apk
  • Existing tests (Worker + Android app)
  • Firebase secret handling (GOOGLE_SERVICES_JSON_B64)
  • Production signing secrets (ANDROID_KEYSTORE_B64 / _PASSWORD / _ALIAS / _KEY_PASSWORD)
  • Capacitor sync step
  • APK verification with apksigner
  • Artifact naming (dsmnru-pyq.apk, dsmnru-pyq-debug-apk)
  • Normal branch pushes and PRs continue to run checks/builds; debug builds are unchanged

Release flow (after merge)

  1. Developer bumps versionName and versionCode in android-app/android/app/build.gradle and merges to android-app.
  2. Developer creates and pushes a tag: git tag v1.4.3 && git push origin v1.4.3.
  3. CI runs checks + release-apk → builds signed APK, verifies signature/package/version.
  4. The new release job:
    • validates tag format and Gradle ↔ tag version match
    • downloads the APK artifact
    • re-verifies signature, package, versionName, versionCode
    • creates/updates GitHub Release DSMNRU PYQ v1.4.3 with dsmnru-pyq.apk as a direct asset and a body containing versionCode: N.

Tests

  • Worker: all existing suites pass (139 + 9 + 50 + 18 + 65 + 45 + 13 + 68 = 407 tests)
  • Android app: 105 tests pass (92 original + 13 new release-automation tests)
  • Workflow YAML validated for syntax
  • Bash tag regex and versionCode grep validated against valid/invalid cases

Adds a dedicated `release` job to .github/workflows/android-apk.yml that:

- triggers only on pushes of semantic version tags vMAJOR.MINOR.PATCH
  (branches and PRs continue running only checks/debug-apk/release-apk
  as before; release job is skipped)
- depends on checks + release-apk — a release is NEVER published if
  tests fail or the production APK fails to build
- requires contents: write only on the release job; other jobs keep
  the default read-only permissions
- downloads the existing dsmnru-pyq.apk Actions artifact (the APK is
  NOT rebuilt a second time; the artifact ZIP is NOT attached)
- validates tag format strictly (rejects v1, v1.4, v1.4.3-beta, etc.)
- cross-checks Gradle versionName against the tag version (mismatch
  fails the release; developer must bump intentionally)
- re-verifies the downloaded APK with apksigner/aapt:
    package = com.dsmnru.pyq
    versionName = tag version
    versionCode = Gradle versionCode
    APK is signed (apksigner verify --print-certs)
- fails loudly if signing secrets are missing on a tag push (instead
  of silently producing an unsigned release)
- generates a release body that ALWAYS contains the required
  'versionCode: N' line (parsed by Worker /api/app-update) plus
  GitHub-generated changelog notes
- creates the release idempotently: reruns detect an existing
  release, ensure the body has versionCode, and avoid duplicate
  APK assets (re-uploads only if sizes differ)
- uses github.token (GITHUB_TOKEN); no PAT is introduced
- never echoes keystore contents, passwords, or base64 secrets to
  logs.

Also adds android-app/test/release-automation.test.mjs covering
tag validation, Gradle/APK metadata parsing, the release-body
versionCode contract, asset selection compatibility with the
existing Worker parser, and workflow-file invariants (tag trigger,
needs chain, least-privilege permissions, download-artifact use,
gh CLI usage, no secret echo).

Existing jobs (checks, debug-apk, release-apk), existing tests,
Firebase secret handling, production signing secret handling,
Capacitor sync, APK verification and artifact naming are preserved.
versionName 1.4.2 / versionCode 13 are NOT bumped; no tags or
releases are created by this change.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@Lav-developer
Lav-developer merged commit c21d02e into android-app Sep 13, 2026
5 checks passed
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.

1 participant