Skip to content

Commit

Permalink
Synchronize branches on release (#2328)
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi authored Nov 28, 2023
1 parent 80e9e30 commit c077f9c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ node("docker") {
}
}

state('synchronize branches') {
if ("$EXECUTION_MODE".toString().equals("Build CLI")) {
masterBranch = 'v2'
devBranch = 'dev'
if (BRANCH?.trim() == 'v1') {
masterBranch = 'v1'
devBranch = 'dev-v1'
}
synchronizeBranches(masterBranch, devBranch)
}
}

stage('install npm') {
installNpm(nodeVersion)
}
Expand Down Expand Up @@ -148,6 +160,28 @@ def runRelease(architectures) {
}
}

def synchronizeBranches(masterBranch, devBranch) {
dir("$cliWorkspace/$repo") {
releaseTag = "v$RELEASE_VERSION"
withCredentials([string(credentialsId: 'ecosystem-github-automation', variable: 'GITHUB_ACCESS_TOKEN')]) {
stage("Merge to $masterBranch") {
sh """#!/bin/bash
git merge origin/$devBranch --no-edit
git push "https://$GITHUB_ACCESS_TOKEN@github.com/jfrog/jfrog-cli.git"
"""
}
stage("Merge to $devBranch") {
sh """#!/bin/bash
git checkout $devBranch
git merge origin/$masterBranch --no-edit
git push "https://$GITHUB_ACCESS_TOKEN@github.com/jfrog/jfrog-cli.git"
git checkout $masterBranch
"""
}
}
}
}

def createTag() {
stage('Create a tag and a GitHub release') {
dir("$jfrogCliRepoDir") {
Expand Down

0 comments on commit c077f9c

Please sign in to comment.