-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile
82 lines (71 loc) · 3.06 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
pipeline {
agent any
tools {
jdk '1.8.0_292'
}
stages {
stage('Build') {
steps {
sh './arcadepaper build'
sh './arcadepaper paperclip'
}
post {
success {
archiveArtifacts artifacts: 'arcade-paperclip.jar', fingerprint: true
}
}
}
stage('Deploy') {
when {
branch "main"
}
steps {
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS_XML')]) {
sh 'mvn -Dmaven.test.skip=true -s $MAVEN_SETTINGS_XML -P public --projects cz.arcadiamc:arcadepaper-api,cz.arcadiamc:arcadepaper-parent deploy'
sh 'mvn -Dmaven.test.skip=true -s $MAVEN_SETTINGS_XML -P internal --projects cz.arcadiamc:arcadepaper deploy'
}
}
}
stage('Javadoc') {
steps {
sh 'mvn -Dmaven.test.skip=true -f ArcadePaper-API javadoc:javadoc -DadditionalJOption=-Xdoclint:none'
javadoc(javadocDir: 'ArcadePaper-API/target/site/apidocs', keepAll: true)
}
}
}
post {
always {
script {
def changeLogSets = currentBuild.changeSets
def message = "**Changes:**"
if (changeLogSets.size() == 0) {
message += "\n*No changes.*"
} else {
def repositoryUrl = scm.userRemoteConfigs[0].url.replace(".git", "")
def count = 0;
def extra = 0;
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
if (count <= 10) {
def entry = entries[j]
def commitId = entry.commitId.substring(0, 6)
message += "\n - [`${commitId}`](${repositoryUrl}/commit/${entry.commitId}) ${entry.msg}"
count++
} else {
extra++;
}
}
}
if (extra != 0) {
message += "\n - ${extra} more commits"
}
}
env.changes = message
}
withCredentials([string(credentialsId: 'discord-webhook-url', variable: 'DISCORD_WEBHOOK')]) {
discordSend description: "**Build:** [${currentBuild.id}](${env.BUILD_URL})\n**Status:** [${currentBuild.currentResult}](${env.BUILD_URL})\n${changes}\n\n[**Artifacts on Jenkins**](https://ci.arcadiamc.cz/job/arcadepaper/job/main/)", footer: 'ArcadiaMC Jenkins', link: env.BUILD_URL, result: currentBuild.currentResult, title: "${env.JOB_NAME} #${currentBuild.id}", webhookURL: DISCORD_WEBHOOK
}
}
}
}