feat: Implement automated versioning system with PowerShell build script and centralized version management

- Add version.properties file as single source of truth for VERSION_NAME and VERSION_CODE
- Create build.ps1 script with automated version bumping (Major/Minor/Patch/None) and build orchestration
- Update app/build.gradle.kts to read version from version.properties instead of hardcoded values
- Display dynamic version info in Settings screen using BuildConfig.VERSION_NAME and VERSION_CODE
- Add
This commit is contained in:
2026-02-12 10:08:58 -05:00
parent 4ed567eb3a
commit b9efb14b8d
5 changed files with 356 additions and 8 deletions
+11 -2
View File
@@ -8,6 +8,15 @@ plugins {
alias(libs.plugins.kotlin.serialization)
}
val versionPropsFile = rootProject.file("version.properties")
val versionProps = Properties().apply {
if (versionPropsFile.exists()) {
versionPropsFile.inputStream().use { load(it) }
}
}
val appVersionCode = (versionProps["VERSION_CODE"] as? String)?.toIntOrNull() ?: 1
val appVersionName = (versionProps["VERSION_NAME"] as? String) ?: "1.0.0"
android {
namespace = "com.shaarit"
compileSdk = 34
@@ -16,8 +25,8 @@ android {
applicationId = "com.shaarit"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
versionCode = appVersionCode
versionName = appVersionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
@@ -1,6 +1,7 @@
package com.shaarit.presentation.settings
import android.content.Intent
import com.shaarit.BuildConfig
import android.net.Uri
import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
@@ -318,7 +319,7 @@ fun SettingsScreen(
SettingsItem(
icon = Icons.Default.Info,
title = "Version",
subtitle = "ShaarIt v1.0",
subtitle = "ShaarIt v${BuildConfig.VERSION_NAME} (build ${BuildConfig.VERSION_CODE})",
onClick = {}
)
}