From e61551bf3756a49f9eb4ee03bd726f3c6167dad7 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 16 Dec 2019 03:19:18 +0530 Subject: Setup snapshot deployment (#599) * Setup snapshot deployment * README: Update repository links * README: Update workflow badge link * README: Add link to Snapshot builds * Fix snapshot/pull-request build conflict * Deploy from feature/deploy-snapshots as well * Revert "Deploy from feature/deploy-snapshots as well" Confirmed it works well This reverts commit 06f6bc0e8c19f238643655d09ca20f83dd416283. Signed-off-by: Harsh Shandilya --- app/build.gradle | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index 6145fe13..9666a547 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,7 +12,30 @@ repositories { maven { url 'https://jitpack.io' } } +final def keystorePropertiesFile = rootProject.file 'keystore.properties' + +final def gitHash = { -> + final def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'describe', '--tags' + standardOutput = stdout + } + stdout.toString().trim() +} + +static final def isSnapshot() { + return System.env['GITHUB_WORKFLOW'] != null && System.env['SNAPSHOT'] != null +} + android { + if (isSnapshot()) { + android.applicationVariants.all { final variant -> + variant.outputs.all { + outputFileName = "aps_${versions.versionName}.apk" + } + } + } + defaultConfig { applicationId 'com.zeapo.pwdstore' } @@ -40,28 +63,19 @@ android { } } - /* - * To sign release builds, create the file `gradle.properties` in - * $HOME/.gradle or in your project directory with this content: - * - * mStoreFile=/path/to/key.store - * mStorePassword=xxx - * mKeyAlias=alias - * mKeyPassword=xxx - */ - if (project.hasProperty('mStoreFile') && - project.hasProperty('mStorePassword') && - project.hasProperty('mKeyAlias') && - project.hasProperty('mKeyPassword')) { + if (keystorePropertiesFile.exists()) { + final def keystoreProperties = new Properties() + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) signingConfigs { release { - storeFile = file(project.properties['mStoreFile'] as String) - storePassword = project.properties['mStorePassword'] as String - keyAlias = project.properties['mKeyAlias'] as String - keyPassword = project.properties['mKeyPassword'] as String + keyAlias = keystoreProperties['keyAlias'] + keyPassword = keystoreProperties['keyPassword'] + storeFile = rootProject.file keystoreProperties['storeFile'] + storePassword = keystoreProperties['storePassword'] } } buildTypes.release.signingConfig = signingConfigs.release + buildTypes.debug.signingConfig = signingConfigs.release } } -- cgit v1.2.3