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:
+11
-2
@@ -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 = {}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user