diff --git a/Jenkinsfile b/Jenkinsfile index d6fbb70..edd0b5f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,5 +51,21 @@ pipeline { } } } + stage('commit version update') { + steps { + script { + withCredentials([usernamePassword(credentialsId: 'gitlab-credentials', passwordVariable: 'PASS', usernameVariable: 'USER')]) { + // git config here for the first time run + sh 'git config --global user.email "jenkins@example.com"' + sh 'git config --global user.name "jenkins"' + + sh "git remote set-url origin https://${USER}:${PASS}@gitlab.com/nanuchi/java-maven-app.git" + sh 'git add .' + sh 'git commit -m "ci: version bump"' + sh 'git push origin HEAD:jenkins-jobs' + } + } + } + } } }