-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
83 lines (75 loc) · 1.82 KB
/
Jenkinsfile
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@Library("Forge-Libs")_
pipeline {
agent any
environment {
WEBHOOK_URL = credentials('discord-webhook')
WEBHOOK_TITLE = "Thread #${BUILD_NUMBER}"
JENKINS_HEAD = 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png'
}
stages {
stage('Notify-Build-Start') {
when {
not {
changeRequest()
}
}
steps {
discordSend(
title: "${WEBHOOK_TITLE} Started",
successful: true,
result: 'ABORTED',
thumbnail: JENKINS_HEAD,
webhookURL: WEBHOOK_URL
)
}
}
stage('Build') {
steps {
sh 'chmod +x gradlew'
sh './gradlew --stacktrace clean build'
}
}
stage('Publish') {
when {
not {
changeRequest()
}
}
environment {
MAVEN_USER = 'buildslave'
MAVEN_PASS = credentials('tomthegeek-maven-password')
}
steps {
sh './gradlew --stacktrace publish'
}
}
stage('Documentation') {
when {
not {
changeRequest()
}
}
steps {
sh './gradlew --stacktrace docs'
javadoc(keepAll: true, javadocDir: 'build/docs/')
}
}
}
post {
always {
script {
archiveArtifacts(artifacts: 'build/libs/*.jar', fingerprint: true, onlyIfSuccessful: true, allowEmptyArchive: true)
if (env.CHANGE_ID == null) {
discordSend(
title: "${WEBHOOK_TITLE} Finished ${currentBuild.currentResult}",
description: '```\n' + getChanges(currentBuild) + '\n```',
successful: currentBuild.resultIsBetterOrEqualTo("SUCCESS"),
result: currentBuild.currentResult,
thumbnail: JENKINS_HEAD,
webhookURL: WEBHOOK_URL
)
}
}
}
}
}