From 6e08a2e6c9285144b5434dc79a9486c4d78768e4 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Sat, 24 Aug 2024 12:11:02 -0600 Subject: [PATCH 1/5] Fix changelog task to use git tag as input --- .../wbrawner/releasehelper/ChangelogTask.kt | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/kotlin/com/wbrawner/releasehelper/ChangelogTask.kt b/buildSrc/src/main/kotlin/com/wbrawner/releasehelper/ChangelogTask.kt index 3f31e56..99a744f 100644 --- a/buildSrc/src/main/kotlin/com/wbrawner/releasehelper/ChangelogTask.kt +++ b/buildSrc/src/main/kotlin/com/wbrawner/releasehelper/ChangelogTask.kt @@ -2,25 +2,37 @@ package com.wbrawner.releasehelper import org.gradle.api.DefaultTask import org.gradle.api.file.RegularFileProperty +import org.gradle.api.internal.provider.Providers import org.gradle.api.model.ObjectFactory +import org.gradle.api.provider.Property +import org.gradle.api.provider.ProviderFactory +import org.gradle.api.tasks.Input import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction import javax.inject.Inject -private const val CHANGELOG_PATH = "src/play/play/release-notes/en-US/default.txt" +private const val CHANGELOG_PATH = "src/play/play/release-notes/en-US/production.txt" -abstract class ChangelogTask @Inject constructor(objectFactory: ObjectFactory) : DefaultTask() { +abstract class ChangelogTask @Inject constructor( + objectFactory: ObjectFactory, + providers: ProviderFactory, +) : DefaultTask() { @get:OutputFile val changelogFile: RegularFileProperty = objectFactory.fileProperty() + @get:Input + @Suppress("UnstableApiUsage") + val latestTag: String = providers.exec { + commandLine("git" , "describe", "--tags", "--abbrev=0") + }.standardOutput.asText.get() + init { changelogFile.set(project.layout.projectDirectory.file(CHANGELOG_PATH)) } @TaskAction fun execute() { - val latestTag = "git describe --tags --abbrev=0".execute() - val changelog = "git log --format=\"%B\" ${latestTag.first().trim()}..".execute() + val changelog = "git log --format=\"%B\" ${latestTag.trim()}..".execute() logger.info("Latest tag: $latestTag") logger.info("Changelog: ${changelog.joinToString("\n")}") changelogFile.get().asFile.writer().use { writer -> @@ -36,4 +48,4 @@ abstract class ChangelogTask @Inject constructor(objectFactory: ObjectFactory) : .start() .inputReader() .readLines() -} \ No newline at end of file +} -- 2.45.2 From 19bb57a4432381740c0194c9fc46012c029f80e6 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Fri, 30 Aug 2024 20:51:44 -0600 Subject: [PATCH 2/5] Add publish credentials to keystore.properties.sample --- app/build.gradle.kts | 2 ++ keystore.properties.sample | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8780e82..aecfa1c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -21,6 +21,7 @@ try { keystoreProperties["keyPassword"] = "" keystoreProperties["storeFile"] = File.createTempFile("temp", ".tmp").absolutePath keystoreProperties["storePassword"] = "" + keystoreProperties["publishCredentialsFile"] = "" } android { @@ -108,6 +109,7 @@ play { enabled.set(false) track.set("production") defaultToAppBundles.set(true) + serviceAccountCredentials.set(file((keystoreProperties["publishCredentialsFile"] as? String).orEmpty())) } dependencies { diff --git a/keystore.properties.sample b/keystore.properties.sample index c67223a..971c0d2 100644 --- a/keystore.properties.sample +++ b/keystore.properties.sample @@ -1,4 +1,5 @@ storePassword= keyPassword= keyAlias= -storeFile= \ No newline at end of file +storeFile= +publishCredentialsFile= \ No newline at end of file -- 2.45.2 From d872bdf012072418dc060b60f424ed35a4d3c192 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Fri, 30 Aug 2024 20:52:12 -0600 Subject: [PATCH 3/5] Update release notes --- app/src/play/play/release-notes/en-US/production.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/play/play/release-notes/en-US/production.txt b/app/src/play/play/release-notes/en-US/production.txt index 0919d34..deb0aa7 100644 --- a/app/src/play/play/release-notes/en-US/production.txt +++ b/app/src/play/play/release-notes/en-US/production.txt @@ -1,5 +1,6 @@ - Fix crash on markdown preview -- Persist preference for Lock Swiping -- Enable gestures on nav drawer when open - Close navigation drawer on back press -- Various dependency updates \ No newline at end of file +- Enable gestures on nav drawer when open +- Persist preference for Lock Swiping +- Update dependencies +- Other minor bug fixes and performance enhancements -- 2.45.2 From dfbdd729c4e7326191e909d2902fbe6f1d9ef20f Mon Sep 17 00:00:00 2001 From: William Brawner Date: Tue, 1 Oct 2024 21:02:43 -0600 Subject: [PATCH 4/5] Only set publishCredentialsFile if present --- app/build.gradle.kts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index aecfa1c..cf3373f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -109,7 +109,9 @@ play { enabled.set(false) track.set("production") defaultToAppBundles.set(true) - serviceAccountCredentials.set(file((keystoreProperties["publishCredentialsFile"] as? String).orEmpty())) + (keystoreProperties["publishCredentialsFile"] as? String)?.let { + serviceAccountCredentials.set(file(it)) + } } dependencies { -- 2.45.2 From 2a970ed3bd4cbf0528714f15ab41c8ab02648f13 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Tue, 1 Oct 2024 22:07:52 -0600 Subject: [PATCH 5/5] Only set publishCredentialsFile if not blank --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index cf3373f..4767551 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -109,7 +109,7 @@ play { enabled.set(false) track.set("production") defaultToAppBundles.set(true) - (keystoreProperties["publishCredentialsFile"] as? String)?.let { + (keystoreProperties["publishCredentialsFile"] as? String)?.ifBlank { null }?.let { serviceAccountCredentials.set(file(it)) } } -- 2.45.2