-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
108 lines (66 loc) · 3.33 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
pipeline {
agent {
docker {
alwaysPull false
image 'microsoft/dotnet:2.1-sdk'
reuseNode false
args '-u root:root'
}
}
stages {
stage('Build') {
steps {
// git branch: 'master', credentialsId: 'GITHUB_USERNAME', url: 'https://github.com/Oragon/Oragon.AspNetCore.Hosting.AMQP.git'
echo sh(script: 'env|sort', returnStdout: true)
sh 'dotnet build ./Oragon.Logging.sln'
}
}
stage('Test') {
steps {
// sh 'dotnet test ./Oragon.Spring.Core.Tests/Oragon.Spring.Core.Tests.csproj --configuration Debug --output ../output--core-tests'
// sh 'dotnet test ./Oragon.Spring.Aop.Tests/Oragon.Spring.Aop.Tests.csproj --configuration Debug --output ../output-aop-tests'
echo 'Disabled at this time'
}
}
stage('Pack') {
when { buildingTag() }
steps {
script{
def projetcs = [
'./Oragon.Logging/Oragon.Logging.csproj',
'./Oragon.Logging.RabbitMQ/Oragon.Logging.RabbitMQ.csproj'
]
if (env.BRANCH_NAME.endsWith("-alpha")) {
for (int i = 0; i < projetcs.size(); ++i) {
sh "dotnet pack ${projetcs[i]} --configuration Debug /p:PackageVersion=${BRANCH_NAME} --include-source --include-symbols --output ../output-packages"
}
} else if (env.BRANCH_NAME.endsWith("-beta")) {
for (int i = 0; i < projetcs.size(); ++i) {
sh "dotnet pack ${projetcs[i]} --configuration Release /p:PackageVersion=${BRANCH_NAME} --output ../output-packages"
}
} else {
for (int i = 0; i < projetcs.size(); ++i) {
sh "dotnet pack ${projetcs[i]} --configuration Release /p:PackageVersion=${BRANCH_NAME} --output ../output-packages"
}
}
}
}
}
stage('Publish') {
when { buildingTag() }
steps {
script {
def publishOnNuGet = ( env.BRANCH_NAME.endsWith("-alpha") == false );
withCredentials([usernamePassword(credentialsId: 'myget-oragon', passwordVariable: 'MYGET_KEY', usernameVariable: 'DUMMY' )]) {
sh 'for pkg in ./output-packages/*.nupkg ; do dotnet nuget push "$pkg" -k "$MYGET_KEY" -s https://www.myget.org/F/oragon/api/v3/index.json ; done'
}
if (publishOnNuGet) {
withCredentials([usernamePassword(credentialsId: 'nuget-luizcarlosfaria', passwordVariable: 'NUGET_KEY', usernameVariable: 'DUMMY')]) {
sh 'for pkg in ./output-packages/*.nupkg ; do dotnet nuget push "$pkg" -k "$NUGET_KEY" -s https://api.nuget.org/v3/index.json ; done'
}
}
}
}
}
}
}