-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
88 lines (77 loc) · 2.48 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
pipeline {
agent {
// Not yet, missing windows 10/11 machine
// docker {
// image 'mcr.microsoft.com/dotnet/sdk:5.0'
// }
label 'Windows'
}
environment {
HOME = '/tmp'
DASZ_NUGET_KEY = credentials('dasz-nuget-key')
}
stages {
stage('Build') {
steps {
sh '''
set +x
dotnet publish --disable-parallel --ignore-failed-sources --configuration Release --output ./bin/Release/ Zetbox.Core.sln
dotnet publish --disable-parallel --ignore-failed-sources --configuration Release --output ./bin/Release/HttpService Zetbox.Server.HttpService/Zetbox.Server.HttpService.csproj
cp -r ./bin/Release/Common ./bin/Release/HttpService
cp -r ./bin/Release/Server ./bin/Release/HttpService
cp -r ./Configs ./bin/Release
'''
archiveArtifacts artifacts: 'bin/Release/**, publish/**', fingerprint: true
}
}
stage('Build Nuget Packages') {
steps {
sh '''
set +x
version="$(gitversion -nofetch -showvariable NuGetVersionV2 | sed -z 's/[\\r\\n]//g')"
echo "Version = $version"
echo "@nuget install ZetboxBasic -Version $version -DependencyVersion Ignore -OutputDirectory \\"%~dp0\\\\bin\\"" > publish/DownloadZetbox.cmd
# publish
rm publish/*.nupkg || true
rm publish/*.nuspec || true
cp publish/* ./bin/Release
echo ""
echo "Converting files"
for f in publish/*.nuspec.template; do
baseName=`echo $f | cut -d "." -f 1`
newExtension=".new"
cp -f $f $baseName.nuspec
sed -i "s/##version##/$version/g" $baseName.nuspec
done
cp ./publish/*.nuspec ./bin/Release
echo "packing files"
for f in ./bin/Release/*.nuspec; do
nuget pack -NoPackageAnalysis $f -OutputDirectory ./publish/
done
'''
archiveArtifacts artifacts: 'publish/*.nupkg', fingerprint: true
}
}
stage('Publish Nuget Packages') {
when {
branch 'master'
}
steps {
sh '''
set +x
dotnet nuget push publish/*.nupkg --skip-duplicate -k $DASZ_NUGET_KEY -s https://office.dasz.at/ngf/api/v2/package
'''
}
}
stage('Description') {
steps {
sh 'GitVersion /nofetch'
sh "GitVersion /nofetch | sed -n 's/\"FullSemVer\": \"\\(.*\\)\",/\\1/p' > VERSION.txt"
script {
def ver = readFile 'VERSION.txt'
currentBuild.description = ver
}
}
}
}
}