From afbccf03a6c3869c92e5940e9ca2a7c2b1a824b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20de=20Souza?= Date: Thu, 9 May 2024 10:07:29 +0200 Subject: [PATCH] Sign release builds from keystore.properties file --- .gitignore | 1 + CHANGELOG.md | 4 ++++ build.gradle.kts | 21 +++++++++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e1a25d6..040dcae 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ /release .DS_Store .gradle +keystore.properties local.properties diff --git a/CHANGELOG.md b/CHANGELOG.md index 45d7cc0..218f325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ - Remove encrypted Dependency Info Block +### Note + +- Sign release builds from keystore.properties file + ## [1.8.5](https://github.com/ldeso/blitz/releases/tag/v1.8.5) – 2024-05-02 This release updates dependencies. diff --git a/build.gradle.kts b/build.gradle.kts index 93bdc4d..ea1416a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,8 @@ // Copyright 2024 Léo de Souza // SPDX-License-Identifier: Apache-2.0 +import java.util.Properties + plugins { kotlin("android") version libs.versions.kotlin alias(libs.plugins.android.application) @@ -23,7 +25,22 @@ android { } signingConfigs { - getByName("debug") { + register("release") { + val keystorePropertiesFile = file("keystore.properties") + if (keystorePropertiesFile.isFile) { + val keystoreProperties = Properties() + keystoreProperties.load(keystorePropertiesFile.inputStream()) + storeFile = file(keystoreProperties.getProperty("storeFile")) + storePassword = keystoreProperties.getProperty("storePassword") + keyAlias = keystoreProperties.getProperty("keyAlias") + keyPassword = keystoreProperties.getProperty("keyPassword") + } else { + val debugSigningConfig = getByName("debug") + storeFile = debugSigningConfig.storeFile + storePassword = debugSigningConfig.storePassword + keyAlias = debugSigningConfig.keyAlias + keyPassword = debugSigningConfig.keyPassword + } enableV3Signing = true enableV4Signing = true } @@ -34,7 +51,7 @@ android { isMinifyEnabled = true isShrinkResources = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) - signingConfig = signingConfigs.getByName("debug") + signingConfig = signingConfigs["release"] } }