forked from Aduhkiss/Magma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
64 lines (61 loc) · 2.22 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
@Library('forge-shared-library') _
pipeline {
agent {
docker { image 'openjdk:8-jdk' }
}
environment {
DISCORD_PREFIX = "Magma: ${BRANCH_NAME} #${BUILD_NUMBER}"
}
stages {
stage('Setup') {
steps {
withCredentials([string(credentialsId: 'DISCORD_WEBHOOK', variable: 'discordWebhook')]) {
discordSend(
title: "${DISCORD_PREFIX} Started",
successful: true,
result: 'ABORTED',
thumbnail: "https://img.hexeption.co.uk/Magma_Block.png",
webhookURL: "${discordWebhook}"
)
}
sh 'git submodule update --init --recursive'
sh 'chmod +x gradlew'
}
}
stage('Build') {
steps {
sh './gradlew launch4j --console=plain'
}
}
stage('Release') {
when {
not {
changeRequest()
}
}
steps {
withCredentials([string(credentialsId: 'GITHUB_TOKEN', variable: 'GITHUB_TOKEN')]) {
sh 'chmod +x gradlew && ./gradlew githubRelease --console=plain'
}
}
}
}
post {
always {
script {
archiveArtifacts artifacts: 'build/distributions/*server.*', fingerprint: true, onlyIfSuccessful: true, allowEmptyArchive: true
withCredentials([string(credentialsId: 'DISCORD_WEBHOOK', variable: 'discordWebhook')]) {
discordSend(
title: "Finished ${currentBuild.currentResult}",
description: '```\n' + getChanges(currentBuild) + '\n```',
successful: currentBuild.resultIsBetterOrEqualTo("SUCCESS"),
result: currentBuild.currentResult,
thumbnail: "https://img.hexeption.co.uk/Magma_Block.png",
webhookURL: "${discordWebhook}"
)
}
cleanWs()
}
}
}
}