forked from WaterdogPE/WaterdogPE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (54 loc) · 1.87 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
pipeline {
agent any
tools {
maven 'Maven 3'
jdk 'Java 11'
}
options {
buildDiscarder(logRotator(artifactNumToKeepStr: '15'))
}
stages {
stage('Build') {
steps {
sh 'sed -i -e s/#build/"${BUILD_ID}"/g ./src/main/java/dev/waterdog/waterdogpe/VersionInfo.java'
sh 'mvn clean package'
}
post {
success {
archiveArtifacts artifacts: 'target/*.jar', fingerprint: true
}
}
}
stage('Snapshot') {
when {
branch "master"
}
steps {
sh 'mvn source:jar deploy -DskipTests'
}
}
stage('Release') {
when {
branch "release"
}
steps {
sh 'mvn javadoc:jar source:jar deploy -DskipTests'
}
}
}
post {
always {
deleteDir()
}
success {
withCredentials([string(credentialsId: 'WDPE_Discord_Webhook', variable: 'TOKEN')]) {
discordSend(webhookURL: "$TOKEN", description: "**Build:** ${env.BUILD_NUMBER}\n**Status:** Success\n\n**Changes:**\n${env.BUILD_URL}", footer: "Waterdog Jenkins", link: "${env.BUILD_URL}", successful: true, title: "Build Success: WaterdogPE", unstable: false, result: "SUCCESS")
}
}
failure {
withCredentials([string(credentialsId: 'WDPE_Discord_Webhook', variable: 'TOKEN')]) {
discordSend(webhookURL: "$TOKEN", description: "**Build:** ${env.BUILD_NUMBER}\n**Status:** Failure\n\n**Changes:**\n${env.BUILD_URL}", footer: "Waterdog Jenkins", link: "${env.BUILD_URL}", successful: true, title: "Build Failed: WaterdogPE", unstable: false, result: "FAILURE")
}
}
}
}