Commit df492d93 authored by Christophe Henry's avatar Christophe Henry
Browse files

Fix Fastlane changelogs and changelog generation

parent f875841d
Pipeline #4373 passed with stage
in 0 seconds
......@@ -30,7 +30,10 @@ pipeline {
def filePath = "$WORKSPACE/app/build.gradle"
def content = changeReleaseVersion(readFile(filePath), params.VERSION)
content = incrementReleaseCode(content)
env.VERSION_CODE = getNewVersionCode(content)
content = incrementReleaseCode(content, env.VERSION_CODE)
new File(filePath).write(content, "utf-8")
sh "git add $filePath"
......@@ -41,7 +44,7 @@ pipeline {
stage("Creating new changelog for version") {
steps {
script {
def changelogPath = "$WORKSPACE/fastlane/metadata/android/en-US/changelogs/${params.VERSION}.txt"
def changelogPath = "$WORKSPACE/fastlane/metadata/android/en-US/changelogs/${env.VERSION_CODE}.txt"
def file = new File(changelogPath)
file.write(normalizeChangelog(params.CHANGELOG), "utf-8")
......@@ -61,7 +64,7 @@ pipeline {
git config --global user.name ${env.GIT_CONFIG_USER_NAME}
git config --global user.email ${env.GIT_CONFIG_USER_MAIL}
git commit -am '[Jenkins CI] $versionSummary'
git tag -f -m "$versionSummary\n\n${normalizeChangelog(params.CHANGELOG)}" v${params.VERSION}
git push --tags origin HEAD:${env.GIT_PUSH_BRANCH}
......@@ -76,11 +79,17 @@ pipeline {
}
@NonCPS
String incrementReleaseCode(String content) {
String getNewVersionCode(String content) {
def regex = "versionCode\\s+(\\d+)"
def match = content =~ regex
match.find()
def newVersion = Integer.parseInt(match.group(1)) + 1
return "$newVersion"
}
@NonCPS
String incrementReleaseCode(String content, String newVersion) {
def regex = "versionCode\\s+(\\d+)"
return content.replaceFirst(~regex, "versionCode $newVersion")
}
......
......@@ -11,12 +11,12 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "com.android.tools.build:gradle:4.0.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$android_navigation"
// Lint
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.22.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:4.3.0"
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment