-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
75 lines (64 loc) · 1.36 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
#!groovy
pipeline {
agent {
label 'macos'
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Building lingohub CLI') {
steps {
sh "swift build -c release -Xswiftc -static-stdlib"
}
}
stage('Installing lingohub CLI') {
// when {
// expression {
// env.BRANCH_NAME == 'master'
// }
// }
steps {
sh "cp -f .build/x86_64-apple-macosx10.10/release/LingoHubCLI /usr/local/bin/lingohub"
sh "lingohub -v"
}
}
}
post {
always {
sh 'rm -rf .build/'
}
success {
notifyBuild()
}
failure {
notifyBuild('ERROR')
}
}
}
def notifyBuild(String buildStatus = 'SUCCESSFUL') {
buildStatus = buildStatus
def colorName = 'RED'
def colorCode = '#FF0000'
def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
def changeSet = getChangeSet()
def message = "${subject} \n ${changeSet}"
if (buildStatus == 'SUCCESSFUL') {
color = 'GREEN'
colorCode = '#00FF00'
} else {
color = 'RED'
colorCode = '#FF0000'
}
slackSend (color: colorCode, message: message)
}
@NonCPS
def getChangeSet() {
return currentBuild.changeSets.collect { cs ->
cs.collect { entry ->
"* ${entry.author.fullName}: ${entry.msg}"
}.join("\n")
}.join("\n")
}