Auto-commit after successful build: improve build setup, update docs/config
Changed files:\n.gitignore SetupBuildEnvironment.sh app/build.gradle.kts keystore.properties.example
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,3 +7,6 @@ android-sdk/
|
|||||||
jdk/
|
jdk/
|
||||||
.tmp-android-build/
|
.tmp-android-build/
|
||||||
.setup-build-environment.state
|
.setup-build-environment.state
|
||||||
|
keystore.properties
|
||||||
|
*.keystore
|
||||||
|
*.jks
|
||||||
@@ -74,6 +74,13 @@ auto_commit_if_needed() {
|
|||||||
|
|
||||||
git -C "$PROJECT_DIR" add -A
|
git -C "$PROJECT_DIR" add -A
|
||||||
|
|
||||||
|
# Defense in depth: never allow signing material or local signing config to be
|
||||||
|
# included in the automatic commit, even if a file was force-added manually.
|
||||||
|
git -C "$PROJECT_DIR" reset -q HEAD -- \
|
||||||
|
keystore.properties \
|
||||||
|
'*.keystore' \
|
||||||
|
'*.jks' 2>/dev/null || true
|
||||||
|
|
||||||
if git -C "$PROJECT_DIR" diff --cached --quiet; then
|
if git -C "$PROJECT_DIR" diff --cached --quiet; then
|
||||||
log "No source changes to commit after successful build"
|
log "No source changes to commit after successful build"
|
||||||
return
|
return
|
||||||
@@ -296,6 +303,12 @@ maybe_build() {
|
|||||||
artifact_source="$PROJECT_DIR/app/build/outputs/bundle/debug/app-debug.aab"
|
artifact_source="$PROJECT_DIR/app/build/outputs/bundle/debug/app-debug.aab"
|
||||||
artifact_target="$PROJECT_DIR/app/build/outputs/bundle/debug/githug-android-debug.aab"
|
artifact_target="$PROJECT_DIR/app/build/outputs/bundle/debug/githug-android-debug.aab"
|
||||||
;;
|
;;
|
||||||
|
--build-release-aab)
|
||||||
|
gradle_task="bundleRelease"
|
||||||
|
artifact_label="release AAB"
|
||||||
|
artifact_source="$PROJECT_DIR/app/build/outputs/bundle/release/app-release.aab"
|
||||||
|
artifact_target="$PROJECT_DIR/app/build/outputs/bundle/release/githug-android-release.aab"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
@@ -324,12 +337,13 @@ Usage: bash ./SetupBuildEnvironment.sh [--build | --build-aab]
|
|||||||
|
|
||||||
--build Setup the environment and build the debug APK
|
--build Setup the environment and build the debug APK
|
||||||
--build-aab Setup the environment and build the debug Android App Bundle (AAB)
|
--build-aab Setup the environment and build the debug Android App Bundle (AAB)
|
||||||
|
--build-release-aab Setup the environment and build a release Android App Bundle (AAB)
|
||||||
EOF_USAGE
|
EOF_USAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
validate_args() {
|
validate_args() {
|
||||||
case "${1:-}" in
|
case "${1:-}" in
|
||||||
""|--build|--build-aab)
|
""|--build|--build-aab|--build-release-aab)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown argument: $1" >&2
|
echo "Unknown argument: $1" >&2
|
||||||
@@ -372,6 +386,7 @@ main() {
|
|||||||
log "To build without a background Gradle daemon: ./gradlew --no-daemon assembleDebug"
|
log "To build without a background Gradle daemon: ./gradlew --no-daemon assembleDebug"
|
||||||
log "To setup and build in one step: bash ./SetupBuildEnvironment.sh --build"
|
log "To setup and build in one step: bash ./SetupBuildEnvironment.sh --build"
|
||||||
log "To setup and build a debug AAB in one step: bash ./SetupBuildEnvironment.sh --build-aab"
|
log "To setup and build a debug AAB in one step: bash ./SetupBuildEnvironment.sh --build-aab"
|
||||||
|
log "To setup and build a release AAB in one step: bash ./SetupBuildEnvironment.sh --build-release-aab"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
|
import java.util.Properties
|
||||||
|
|
||||||
|
val keystoreProperties = Properties()
|
||||||
|
val keystorePropertiesFile = rootProject.file("keystore.properties")
|
||||||
|
if (keystorePropertiesFile.exists()) {
|
||||||
|
keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) }
|
||||||
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("org.jetbrains.kotlin.android")
|
id("org.jetbrains.kotlin.android")
|
||||||
@@ -11,16 +19,30 @@ android {
|
|||||||
applicationId = "solutions.tretter.githugandroid"
|
applicationId = "solutions.tretter.githugandroid"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 82
|
versionCode = 83
|
||||||
versionName = "0.1.81"
|
versionName = "0.1.82"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
if (keystorePropertiesFile.exists()) {
|
||||||
|
create("release") {
|
||||||
|
storeFile = file(keystoreProperties.getProperty("storeFile"))
|
||||||
|
storePassword = keystoreProperties.getProperty("storePassword")
|
||||||
|
keyAlias = keystoreProperties.getProperty("keyAlias")
|
||||||
|
keyPassword = keystoreProperties.getProperty("keyPassword")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = false
|
||||||
|
if (signingConfigs.findByName("release") != null) {
|
||||||
|
signingConfig = signingConfigs.getByName("release")
|
||||||
|
}
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
"proguard-rules.pro"
|
"proguard-rules.pro"
|
||||||
|
|||||||
4
keystore.properties.example
Normal file
4
keystore.properties.example
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
storeFile=/absolute/path/to/githug-upload.keystore
|
||||||
|
storePassword=change-me
|
||||||
|
keyAlias=githug-upload
|
||||||
|
keyPassword=change-me
|
||||||
Reference in New Issue
Block a user