Debian Codegraph @

JenkinsfileRelease

raw
1 pipeline {
2 agent {
3 docker {
4 image 'maven:3.6-jdk-11'
5 args '-v /home/jenkins/.m2:/var/maven/.m2 -v /home/jenkins/.gnupg:/.gnupg -e MAVEN_CONFIG=/var/maven/.m2 -e MAVEN_OPTS=-Duser.home=/var/maven'
6 }
7 }
8 environment {
9 GPG_SECRET = credentials('gpg_password')
10 GITHUB = credentials('Github-Username-Pw')
11 GITHUB_RELEASE_TOKEN = credentials('github_registry_release')
12 GIT_ASKPASS='./.git-askpass'
13 }
14 stages {
15 stage ('Ensure dev branch') {
16 when {
17 expression {
18 return env.BRANCH_NAME != 'dev';
19 }
20 }
21 steps {
22 error("Releasing is only possible from dev branch")
23 }
24 }
25 stage ('Set Git Information') {
26 steps {
27 sh 'echo \'echo \$GITHUB_PSW\' > ./.git-askpass'
28 sh 'chmod +x ./.git-askpass'
29 sh 'git config url."https://[email protected]/".insteadOf "https://github.com/"'
30 sh 'git config url."https://[email protected]/".insteadOf "ssh://[email protected]/"'
31 sh 'git config url."https://[email protected]/".insteadOf "[email protected]:"'
32 sh 'git config user.email "[email protected]"'
33 sh 'git config user.name "Jenkins"'
34 }
35 }
36 stage('Create release branch') {
37 steps {
38 sh 'mvn -B -Prelease gitflow:release-start'
39 }
40 }
41 stage('Verify release') {
42 steps {
43 sh 'mvn -B -Prelease -Dgpg.passphrase=${GPG_SECRET} verify'
44 }
45 }
46 stage('Perform release') {
47 steps {
48 sh "mvn -B gitflow:release-finish -DargLine=\"-Prelease -B -Dgpg.passphrase=${GPG_SECRET} -DskipTests\""
49 }
50 }
51 stage('Create GitHub release') {
52 steps {
53 sh 'git checkout master'
54 sh "mvn -B github-release:github-release -Dgithub.release-token=${GITHUB_RELEASE_TOKEN}"
55 }
56 }
57 }
58 }