Skip to content

Commit 9079d81

Browse files
committed
improve order of checking out the release branch
As first step we should check out the release branch, not modify the gradle.properties file to parse the release version afterwards from it. Signed-off-by: Peter Gafert <[email protected]>
1 parent 6a4a518 commit 9079d81

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

build-steps/release/publish.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,20 @@ def executeCommand = { String command ->
140140

141141
task prepareRelease() {
142142
doFirst {
143-
updateVersion { int oldMajor, int oldMinor, int oldPatch, String oldSuffix -> "$oldMajor.$oldMinor.$oldPatch" }
143+
String releaseVersion = withCurrentVersion { int oldMajor, int oldMinor, int oldPatch, String oldSuffix -> "$oldMajor.$oldMinor.$oldPatch" }
144144

145-
String currentVersion = getCurrentVersion()
146-
def releaseBranch = "release-$currentVersion"
145+
def releaseBranch = "release-$releaseVersion"
147146
executeCommand("git checkout -b $releaseBranch")
148147
String currentBranch = executeCommand('git rev-parse --abbrev-ref HEAD')
149148
assert currentBranch == releaseBranch: "Mismatch: Should be on branch $releaseBranch but current branch is $currentBranch"
150149

150+
updateVersion { major, minor, patch, suffix -> releaseVersion }
151+
151152
String lastReleaseVersion = getLastReleaseVersion()
152153
['README.md', 'docs/_data/navigation.yml', 'docs/_pages/getting-started.md'].each {
153154
new File(project.rootDir, it).with { file ->
154-
println "Replacing last release version $lastReleaseVersion by $currentVersion in file ${file.absolutePath}"
155-
file.text = file.text.replaceAll(lastReleaseVersion, currentVersion)
155+
println "Replacing last release version $lastReleaseVersion by $releaseVersion in file ${file.absolutePath}"
156+
file.text = file.text.replaceAll(lastReleaseVersion, releaseVersion)
156157
}
157158
}
158159
}

0 commit comments

Comments
 (0)