forked from awslabs/elasticache-cluster-config-net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
53 lines (51 loc) · 1.19 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
pipeline {
agent {
dockerfile { filename 'Dockerfile.build' }
}
environment {
// Jenkins doesnt set a $HOME and causes dotnet to fail
// https://issues.jenkins-ci.org/browse/JENKINS-31225
HOME="${WORKSPACE}"
output_dir="${WORKSPACE}/output/build"
nexus_url=getConfig('nexus_url')
Version=getVersion()
Location="${WORKSPACE}/Amazon.ElastiCacheCluster/Amazon.ElastiCacheCluster.csproj"
}
stages {
stage('Setup') {
steps {
script {
dir("${WORKSPACE}/output") {
deleteDir()
}
setDisplayInfo(Version)
}
}
}
stage('Pack') {
steps {
sh "dotnet pack ${Location} -c:Release -o ${output_dir} /p:Version=${Version} /p:PackageVersion=${Version}"
}
}
stage('Publish') {
when{
branch 'master'
}
steps {
withCredentials([string(credentialsId: 'nexus:deployer', variable: 'KEY')]) {
sh '''
dotnet nuget push ${output_dir}/*.nupkg -s ${nexus_url} -k ${KEY}
'''
}
}
}
}
post{
always {
dir("${WORKSPACE}/output") {
deleteDir()
}
setDisplayInfo(Version)
}
}
}