pipeline { agent { docker { image 'mcr.microsoft.com/dotnet/sdk:7.0'} } 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'],[pattern: 'NuGet.Config', type: 'INCLUDE']] dir('publish') { deleteDir() } withCredentials([usernamePassword(credentialsId: 'giteaNugetPushCreds', passwordVariable: 'NUGETPWD', usernameVariable: 'NUGETUSR')]) { sh 'dotnet nuget add source --name piwigo.git.haefelfinger.net --username $NUGETUSR --password $NUGETPWD --store-password-in-clear-text https://git.haefelfinger.net/api/packages/piwigo/nuget/index.json' } } } stage('nuget restore') { steps { sh "dotnet restore ${env.WORKSPACE}/PiwigoDirectorySync.sln" } } stage('test') { steps { sh "dotnet test ${env.WORKSPACE}/PiwigoDirectorySync.sln --no-restore" } } stage('build linux binary') { steps { 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}" } } stage('build windows binary') { steps { 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}" } } } post { always { archiveArtifacts artifacts: "publish/**/*", onlyIfSuccessful: true } } }