diff --git a/Jenkinsfile b/Jenkinsfile index 3d6d13f..abb3b11 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,6 +72,14 @@ onlyif = (! deployBranches.contains(lazyConfig['branch']) ) tasks = [ run: { + def currentVersion = androidVersion() + currentBuild.displayName = "#${env.BUILD_NUMBER} ${currentVersion.string}-${currentVersion.number}" + // Try to see if we can still merge the deploy branches + deployBranches.each { deployBranch -> + gitMerge(workingBranch, deployBranch) + } + // Go back to working branch for validation + sh("git checkout ${workingBranch}") fastLane('android', 'test') }, on: 'android', @@ -105,37 +113,39 @@ tasks = [ run: { def currentVersion = androidVersion() + + // Define next version based on optional input + def nextVersion = [ string: currentVersion.string, number: currentVersion.number + 1 ] + if (env.lazyInput) { + nextVersion = [ string: env.lazyInput, number: nextVersion.number ] + } + gitAuth('bot-ci-dgm', { - // Define next version based on optional input - def nextVersion = [ string: currentVersion.string, number: currentVersion.number + 1 ] - if (env.lazyInput) { - nextVersion = [ string: env.lazyInput, number: nextVersion.number ] + // Refresh each deploy branches with changes from the working branch + deployBranches.each { deployBranch -> + gitMerge(workingBranch, deployBranch) + gitPush(remote, deployBranch) } - // Refresh latest changelogs and bump version in working branch before deploying + // Tag the working branch sh("git checkout ${workingBranch}") + gitTag("${currentVersion.string}-${currentVersion.number}", remote) + + // Refresh latest changelogs and bump version in working branch before deploying fastChangeLogs(nextVersion.number, 'android') androidVersion(nextVersion) gitCommit("Provide changelogs for version ${nextVersion.number}", 'fastlane/metadata/android') gitCommit("Update version to ${nextVersion.string}-${nextVersion.number}", 'app/build.gradle') - // Refresh each deploy branches with changes from the working branch - try { - deployBranches.each { deployBranch -> - gitMerge(workingBranch, deployBranch) - gitPush(remote, deployBranch) - } - } finally { // Publish and tag the working branch with latest changelogs and version anyway - gitPush(remote, workingBranch) - gitTag("${currentVersion.string}-${currentVersion.number}", remote) - } + // Publish working branch with latest changelogs and next version + gitPush(remote, workingBranch) }) }, on: 'android', ] } -// From systemtest to production, only for release branches +// From alpha to beta, only for deploy branches lazyStage { name = 'alpha' onlyif = ( deployBranches.contains(lazyConfig['branch']) )