File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed
Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -146,11 +146,29 @@ dependencies {
146146
147147tasks.register<DefaultTask >(" updateAppChangelog" ) {
148148 doLast {
149- updateChangelog(null )
150- copy {
151- from(" ../CHANGELOG.md" ).into(" src/main/res/raw" ).rename { it.lowercase() }
149+ val rawResourcesPath = " src/main/res/raw"
150+ val changelogFilename = " CHANGELOG.md"
151+ val updateAppChangelog = {
152+ delete(" $rawResourcesPath /$changelogFilename " )
153+ updateChangelog(null )
154+ copy {
155+ from(" ../$changelogFilename " ).into(rawResourcesPath).rename { it.lowercase() }
156+ }
157+ execute(" git" , " checkout" , changelogFilename)
158+ }
159+ // Ignore failure with local builds
160+ val ignoreFailure = Environment .getVariablesOrNull(" CI" ).firstOrNull().toBoolean().not ()
161+ if (ignoreFailure) {
162+ try {
163+ updateAppChangelog()
164+ } catch (_: Exception ) {
165+ val errorMessage = " There was an error while generating the changelog."
166+ logger.error(errorMessage)
167+ file(" $rawResourcesPath /${changelogFilename.lowercase()} " ).writeText(errorMessage)
168+ }
169+ } else {
170+ updateAppChangelog()
152171 }
153- execute(" git" , " checkout" , " CHANGELOG.md" )
154172 }
155173}
156174
You can’t perform that action at this time.
0 commit comments