Skip to content

Instantly share code, notes, and snippets.

@ridakk
Created August 16, 2019 12:17
Show Gist options
  • Save ridakk/23909efdd52c6ecce1c3fa07e68c7347 to your computer and use it in GitHub Desktop.
Save ridakk/23909efdd52c6ecce1c3fa07e68c7347 to your computer and use it in GitHub Desktop.
jenkinsfile scm with local branch to push remote repository
node {
nodejs('[email protected]') {
stage('checkout') {
checkout([
$class: 'GitSCM',
branches: [[name: '*/development']], // solves detached head issue
extensions: [[$class: 'LocalBranch', localBranch: '**']], // required to push changes to remote repo
userRemoteConfigs: scm.userRemoteConfigs
])
}
stage('npm install') {
sh 'npm install'
}
stage('npm version') {
sh "npm run release"
}
stage('push to bitbucket') {
sh "git push --follow-tags origin development"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment