-
Notifications
You must be signed in to change notification settings - Fork 0
/
JenkinsfileRelease
57 lines (57 loc) · 1.86 KB
/
JenkinsfileRelease
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
pipeline {
agent {
docker {
// Need an image with git installed that is why we stick with maven image for now though we're using gradle
image 'maven:3.6-jdk-11'
args '-v /home/jenkins/.gradle:/var/gradle/.gradle -v /home/jenkins/.gnupg:/.gnupg -e GRADLE_OPTS=-Duser.home=/var/gradle'
}
}
environment {
GITHUB = credentials('Github-Username-Pw')
GITHUB_RELEASE_TOKEN = credentials('github_registry_release')
GIT_ASKPASS='./.git-askpass'
COVERALLS_REPO_TOKEN = credentials('coveralls_repo_token_snapshot_tests')
ORG_GRADLE_PROJECT_sonatype = credentials('SONATYPE_NEXUS')
ORG_GRADLE_PROJECT_signingPassword = credentials('gpg_password')
ORG_GRADLE_PROJECT_base64EncodedAsciiArmoredSigningKey = credentials('gpg_private_key')
}
stages {
stage ('Ensure dev branch') {
when {
expression {
return env.BRANCH_NAME != 'dev';
}
}
steps {
error("Releasing is only possible from dev branch")
}
}
stage ('Set Git Information') {
steps {
sh 'echo \'echo \$GITHUB_PSW\' > ./.git-askpass'
sh 'chmod +x ./.git-askpass'
sh 'git config url."https://[email protected]/".insteadOf "https://github.com/"'
sh 'git config url."https://[email protected]/".insteadOf "ssh://[email protected]/"'
sh 'git config url."https://[email protected]/".insteadOf "[email protected]:"'
sh 'git config user.email "[email protected]"'
sh 'git config user.name "Jenkins"'
}
}
stage('Build Release') {
steps {
sh './gradlew build testAgainstJava17'
}
}
stage('Perform release') {
steps {
sh './gradlew release'
}
}
stage('Create GitHub release') {
steps {
sh 'git checkout main'
sh './gradlew githubRelease -Pgh_token=${GITHUB_RELEASE_TOKEN}'
}
}
}
}