Skip to content

Commit

Permalink
Synchronize branches on release
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi committed Nov 27, 2023
1 parent 96ddaba commit 9251a62
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ node("docker") {
}
}

state('synchronize branches') {
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 +158,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 9251a62

Please sign in to comment.