-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
66 lines (66 loc) · 1.66 KB
/
Jenkinsfile
File metadata and controls
66 lines (66 loc) · 1.66 KB
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
def gitVersion
pipeline {
agent {
docker {
image 'hseeberger/scala-sbt:11.0.11_1.5.3_2.13.6'
}
}
environment {
GITHUB_TOKEN = credentials('sbt-publisher-token')
GH_TOKEN = credentials('github-api')
SBT_OPS = '-Dsbt.global.base=.sbt -Dsbt.boot.directory=.sbt -Dsbt.ivy.home=.ivy2 -Dlocal=false'
MONGO_URL = credentials('mongo-connector-cluster')
}
parameters {
choice(
name: 'VersionType',
choices: "minor\nmajor\nhotfix",
description: 'What type of version to build.'
)
}
options {
ansiColor('xterm')
}
stages {
stage('Compile project') {
steps {
script {
sh 'sbt $SBT_OPS clean compile'
}
}
}
stage('Version project') {
when {
branch 'master'
}
steps {
script {
build job: 'operations/create-a-release', parameters: [string(name: 'Project', value: 'log-encoding'), string(name: 'Type', value: params.VersionType)]
gitVersion = sh(
script: '''
JQ=./jq
curl https://stedolan.github.io/jq/download/linux64/jq > $JQ && chmod +x $JQ
curl -H "Accept: application/vnd.github.manifold-preview" -H 'Authorization: token '$GH_TOKEN'' -s 'https://api.github.com/repos/cjww-development/log-encoding/releases/latest' | ./jq -r '.tag_name'
''',
returnStdout: true
).trim()
}
}
}
stage('Publish artefact') {
when {
branch 'master'
}
steps {
script {
sh "sbt $SBT_OPS -Dversion=$gitVersion publish"
}
}
}
}
post {
always {
cleanWs()
}
}
}