pipeline { agent { docker { image 'mcr.microsoft.com/dotnet/sdk:6.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']] 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 { sh "dotnet restore ${env.WORKSPACE}/photo.haefelfinger.workflow.sln" } } stage('test') { steps { sh "dotnet test ${env.WORKSPACE}/photo.haefelfinger.workflow.sln --no-restore" } } stage('build api') { steps { sh "/bin/true" } } stage('api docker image') { steps { sh "/bin/true" } } stage('build cli') { steps { sh "dotnet publish ${env.WORKSPACE}/photo.haefelfinger.workflow.cli/photo.haefelfinger.workflow.cli.csproj -c Release --self-contained true -r linux-x64 -o ${env.WORKSPACE}/publish/cli-linux -p:Version=${env.APPVERSION}.${env.BUILD_NUMBER}" sh "dotnet publish ${env.WORKSPACE}/photo.haefelfinger.workflow.cli/photo.haefelfinger.workflow.cli.csproj -c Release --self-contained true -r win-x64 -o ${env.WORKSPACE}/publish/cli-win -p:Version=${env.APPVERSION}.${env.BUILD_NUMBER}" } } stage('publish docker images') { steps { sh "/bin/true" } } } post { always { archiveArtifacts artifacts: "publish/**/*", onlyIfSuccessful: true } } }