2023-08-29 22:37:24 +02:00
|
|
|
pipeline {
|
|
|
|
agent {
|
2023-08-30 23:47:02 +02:00
|
|
|
docker { image 'mcr.microsoft.com/dotnet/sdk:7.0'}
|
2023-08-29 22:37:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
|
|
|
APPVERSION = "0.0.1"
|
|
|
|
HOME = "${env.WORKSPACE}"
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('preparing workspace') {
|
|
|
|
steps {
|
|
|
|
cleanWs deleteDirs: true, notFailBuild: true, patterns: [[pattern: '.nuget/NuGet/NuGet.Config', type: 'INCLUDE']]
|
|
|
|
dir('publish') {
|
|
|
|
deleteDir()
|
|
|
|
}
|
|
|
|
withCredentials([usernamePassword(credentialsId: 'giteaNugetPushCreds', passwordVariable: 'NUGETPWD', usernameVariable: 'NUGETUSR')]) {
|
|
|
|
sh 'dotnet nuget add source --name gitea --username $NUGETUSR --password $NUGETPWD --store-password-in-clear-text https://git.haefelfinger.net/api/packages/piwigo/nuget/index.json'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('nuget restore') {
|
|
|
|
steps {
|
2023-08-30 23:47:02 +02:00
|
|
|
sh "dotnet restore ${env.WORKSPACE}/PiwigoDirectorySync.sln"
|
2023-08-29 22:37:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('test') {
|
|
|
|
steps {
|
2023-08-30 23:47:02 +02:00
|
|
|
sh "dotnet test ${env.WORKSPACE}/PiwigoDirectorySync.sln --no-restore"
|
2023-08-29 22:37:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-30 23:47:02 +02:00
|
|
|
stage('build linux binary') {
|
2023-08-29 22:37:24 +02:00
|
|
|
steps {
|
2023-08-30 23:47:02 +02:00
|
|
|
sh "dotnet publish ${env.WORKSPACE}/PiwigoDirectorySync/PiwigoDirectorySync.csproj -c Release --self-contained true -r linux-x64 -o ${env.WORKSPACE}/publish/linux/PiwigoDirectorySync -p:Version=${env.APPVERSION}.${env.BUILD_NUMBER}"
|
2023-08-29 22:37:24 +02:00
|
|
|
}
|
|
|
|
}
|
2023-08-30 23:47:02 +02:00
|
|
|
|
|
|
|
stage('build windows binary') {
|
2023-08-29 22:37:24 +02:00
|
|
|
steps {
|
2023-08-30 23:47:02 +02:00
|
|
|
sh "dotnet publish ${env.WORKSPACE}/PiwigoDirectorySync/PiwigoDirectorySync.csproj -c Release --self-contained true -r win-x64 -o ${env.WORKSPACE}/publish/windows/PiwigoDirectorySync.exe -p:Version=${env.APPVERSION}.${env.BUILD_NUMBER}"
|
2023-08-29 22:37:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
archiveArtifacts artifacts: "publish/**/*", onlyIfSuccessful: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|