Skip to content

feat: derive versionName/versionCode from the v* tag - #21

Merged
willwade merged 1 commit into
mainfrom
feat/version-from-tag
Aug 22, 2026
Merged

feat: derive versionName/versionCode from the v* tag#21
willwade merged 1 commit into
mainfrom
feat/version-from-tag

Conversation

@willwade

Copy link
Copy Markdown
Contributor

Found while cutting v0.1.8: versionName had been stuck at "0.1.0" since inception (manually bumped to 0.1.8 in #20). With RFC 0016's version line now shipped, the tag should be the single source of truth. Companion: Dasher-GTK #56 (same treatment via CMake git describe).

Changes (app/build.gradle.kts)

  • versionName = most recent v* tag via git describe --tags --match v* run from the repo root: tag builds report the tag exactly; dev builds report 0.1.8-3-g1a2b3c4. The literal constants remain only as no-git (tarball) fallbacks.
  • versionCode = 1000 + commit count (git rev-list --count HEAD) — deterministic, strictly monotonic, and above every historically shipped code (max 8). No more manual versionCode arithmetic.
  • release.yml: on v* tag pushes, the built APK's versionName (read via aapt2 dump badging) must equal the tag, else the workflow fails before publishing — a mislabelled APK can never ship.

Verified locally

  • APK badging on this branch: versionName='0.1.8' versionCode='1060' (1000 + 60 commits).
  • Simulated dev commit on top of the tag: describe → 0.1.8-1-g457c264.
  • :app:assembleDebug green.

DCO signed.

versionName sat at '0.1.0' for eight releases because nothing forced the
bump; the RFC 0016 version line would have shown it. Now the tag is the
single source of truth:

- versionName = most recent v* tag via git describe (tag builds report
  the tag exactly; dev builds '0.1.8-3-g1a2b3c4'); constants demoted to
  no-git fallbacks.
- versionCode = 1000 + commit count (deterministic, monotonic, and
  above every historically shipped code).
- release.yml gate: on v* tags, the built APK's versionName must equal
  the tag or the release fails before publishing.

Verified: APK badging shows versionName 0.1.8 / versionCode 1060 on the
v0.1.8 commit; simulated dev commit reports 0.1.8-1-g<sha>.

Signed-off-by: will wade <willwade@gmail.com>
@willwade
willwade merged commit ad94278 into main Aug 22, 2026
2 checks passed
@willwade
willwade deleted the feat/version-from-tag branch August 22, 2026 10:41
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